fix(slack): use named import for @slack/bolt App class (#299)

* fix(slack): use named import for @slack/bolt App class

The default import `import bolt from '@slack/bolt'` followed by
`const { App } = bolt` doesn't work correctly in Bun due to ESM/CJS
interop issues. The default export comes through as a function rather
than the module object.

Switching to a named import `import { App } from '@slack/bolt'`
resolves the issue and allows the Slack provider to start successfully.

* fix(slack): align Bolt mock with named App export

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
Simon Kelly
2026-01-06 16:22:14 +02:00
committed by GitHub
parent c16510c6ea
commit 5aa1ed2c96
3 changed files with 6 additions and 6 deletions

View File

@@ -70,7 +70,7 @@ vi.mock("@slack/bolt", () => {
start = vi.fn().mockResolvedValue(undefined);
stop = vi.fn().mockResolvedValue(undefined);
}
return { default: { App } };
return { App, default: { App } };
});
const flush = () => new Promise((resolve) => setTimeout(resolve, 0));

View File

@@ -1,8 +1,8 @@
import type {
SlackCommandMiddlewareArgs,
SlackEventMiddlewareArgs,
import {
App,
type SlackCommandMiddlewareArgs,
type SlackEventMiddlewareArgs,
} from "@slack/bolt";
import bolt from "@slack/bolt";
import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js";
import { hasControlCommand } from "../auto-reply/command-detection.js";
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
@@ -418,7 +418,6 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) {
return false;
};
const { App } = bolt;
const app = new App({
token: botToken,
appToken,