Skip to content

fix(slack): handle bolt import for CJS/ESM compatibility#1208

Merged
steipete merged 5 commits intoopenclaw:mainfrom
24601:fix/slack-bolt-import
Jan 20, 2026
Merged

fix(slack): handle bolt import for CJS/ESM compatibility#1208
steipete merged 5 commits intoopenclaw:mainfrom
24601:fix/slack-bolt-import

Conversation

@24601
Copy link
Copy Markdown
Contributor

@24601 24601 commented Jan 19, 2026

Fixes #1209.

Summary

  • Prevent Slack monitor startup crash when @slack/bolt resolves to a CJS/ESM shape without named exports.
  • Resolve App/HTTPReceiver from the default export or module namespace for compatibility.

Root cause

  • In Node ESM, importing a CJS module can yield the App constructor as the default export (no named exports). Destructuring App/HTTPReceiver from the namespace then fails and new App() throws.

Details

  • Handles ESM namespace ({ App, HTTPReceiver }), default module object, and default App class shapes.
  • Keeps Bun behavior while adding mocks for HTTPReceiver in Slack monitor tests.

Tests

  • Not run locally (import wiring + test mocks updated).

CI Notes

  • pnpm format and Windows gateway.sigterm are currently failing on main (unrelated to this change).

@24601 24601 marked this pull request as draft January 19, 2026 03:24
@24601 24601 force-pushed the fix/slack-bolt-import branch from acfac8c to b265f53 Compare January 19, 2026 03:40
@steipete
Copy link
Copy Markdown
Contributor

Wait, how does this not explode on my machine? Wjat is your node version?

@24601
Copy link
Copy Markdown
Contributor Author

24601 commented Jan 19, 2026

Running Node v25.2.1. The CJS/ESM interop behavior just maybe sensitive to Node versions? 🤷‍♂️

I know, comment feels bot-ish, but I am not a bot, please don't ban me, hahaha.

@24601
Copy link
Copy Markdown
Contributor Author

24601 commented Jan 19, 2026

Wait, how does this not explode on my machine? Wjat is your node version?

I will try with downlevel and report back, too.

@24601
Copy link
Copy Markdown
Contributor Author

24601 commented Jan 19, 2026

Wait, how does this not explode on my machine? Wjat is your node version?

Going down to v24 all is good. But in doing that, it occurred to me that perhaps there was inconsistent libs in the dist/build causing this actually, but pnpm i/u reported all up to date/proper resolution, but I'll try to replicate with a clean install on v25 tomorrow.

@steipete
Copy link
Copy Markdown
Contributor

I run 25.3

@24601
Copy link
Copy Markdown
Contributor Author

24601 commented Jan 19, 2026

I run 25.3

So on 25.3 and 25.4 I still get this...even after nuking caches, etc (was hoping it was some odd lib version issue).

I'll continue to try to investigate...

[clawdbot] Skipping build; dist is fresh.

🦞 Clawdbot 2026.1.17-1 (39dfdcc) — I'll refactor your busywork like it owes me money.

21:25:13 (node:26813) [DEP0040] DeprecationWarning: The punycode module is deprecated. Please use a userland alternative instead.
(Use node --trace-deprecation ... to show where the warning was created)
....blah, blah, blah....
21:25:14 [slack] [default] starting provider
21:25:14 [slack] [default] channel exited: App is not a constructor
21:25:14 [voice-call] Media streaming initialized
...blah, blah, blah....
Ctrl+C to stop.

Starting with pnpm clawdbot gateway, mise installed 25.4 on macos.

@steipete steipete force-pushed the fix/slack-bolt-import branch from 3560ab9 to 5f6115b Compare January 20, 2026 10:32
@steipete steipete force-pushed the fix/slack-bolt-import branch from 5f6115b to cf04b0e Compare January 20, 2026 10:46
@steipete steipete marked this pull request as ready for review January 20, 2026 10:46
@steipete steipete merged commit 322c8dc into openclaw:main Jan 20, 2026
14 of 22 checks passed
@steipete
Copy link
Copy Markdown
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && pnpm test
  • Land commit: cf04b0e
  • Merge commit: 322c8dc

Thanks @24601!

@steipete
Copy link
Copy Markdown
Contributor

Correction (formatting):

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && pnpm test
  • Land commit: cf04b0e
  • Merge commit: 322c8dc

Thanks @24601!

@steipete
Copy link
Copy Markdown
Contributor

Correction (formatting, literal newlines):

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && pnpm test
  • Land commit: cf04b0e
  • Merge commit: 322c8dc

Thanks @24601!

zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
fix(slack): handle bolt import for CJS/ESM compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack plugin crashes on startup: 'App is not a constructor'

2 participants