Code Monkey home page Code Monkey logo

Comments (4)

Jarred-Sumner avatar Jarred-Sumner commented on July 18, 2024 1

Thank you! I ended up getting it to work by changing to a fixed URL via ngrok however it now creates an error every time an event is received but still manages to execute the events normally and works otherwise fine.

[ERROR]  bolt-app 20 |     ErrorCode["UnknownError"] = "slack_bolt_unknown_error";
21 |     ErrorCode["WorkflowStepInitializationError"] = "slack_bolt_workflow_step_initialization_error";
22 | })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
23 | class UnknownError extends Error {
24 |     constructor(original) {
25 |         super(original.message);
             ^
error: JSGlobalProxy is not a constructor
 code: "slack_bolt_unknown_error"

      at new UnknownError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/errors.js:25:9)
      at asCodedError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/errors.js:35:12)
      at handleError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/App.js:612:35)

[ERROR]   An unhandled error occurred while Bolt processed an event
[ERROR]  bolt-app 20 |     ErrorCode["UnknownError"] = "slack_bolt_unknown_error";
21 |     ErrorCode["WorkflowStepInitializationError"] = "slack_bolt_workflow_step_initialization_error";
22 | })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
23 | class UnknownError extends Error {
24 |     constructor(original) {
25 |         super(original.message);
             ^
error: JSGlobalProxy is not a constructor
 code: "slack_bolt_unknown_error"

      at new UnknownError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/errors.js:25:9)
      at asCodedError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/errors.js:35:12)
      at handleError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/App.js:612:35)

[ERROR]   An unhandled error occurred while Bolt processed an event

This error would happen if some code did new globalThis or new global.

Most likely, somewhere the this value is (incorrectly) set to globalThis and then some other code calls new this. If a dependency is using vm that could also be related.

Either way though, this is a bug in Bun and not in @slack/bolt. Feel free to open an issue in Bun's github repository.

from bolt-js.

zimeg avatar zimeg commented on July 18, 2024

Hey @kcoderhtml! 👋 Thanks for writing in! It's neat to see some bun use with @slack/bolt!

I'm not immediately sure of what causes this, but I believe it's something related to the bun runtime 🤔 When testing this with bun I find the same debug logs without a message being sent to channel, but node responds in channel as expected.

This isn't ideal (it'd be better if it worked) but makes sense to me since @slack/bolt is backed by @slack/web-api which is a part of the slackapi/node-slack-sdk. For that reason I don't believe a fix will be prioritized at this time (larger changes seem to be required) but perhaps the unofficial but well-maintained slack-edge can offer the bun support?

In any case let's leave this issue open for a while in case other discoveries are made or if other troubles are existing with say!

from bolt-js.

kcoderhtml avatar kcoderhtml commented on July 18, 2024

Thank you! I ended up getting it to work by changing to a fixed URL via ngrok however it now creates an error every time an event is received but still manages to execute the events normally and works otherwise fine.

[ERROR]  bolt-app 20 |     ErrorCode["UnknownError"] = "slack_bolt_unknown_error";
21 |     ErrorCode["WorkflowStepInitializationError"] = "slack_bolt_workflow_step_initialization_error";
22 | })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
23 | class UnknownError extends Error {
24 |     constructor(original) {
25 |         super(original.message);
             ^
error: JSGlobalProxy is not a constructor
 code: "slack_bolt_unknown_error"

      at new UnknownError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/errors.js:25:9)
      at asCodedError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/errors.js:35:12)
      at handleError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/App.js:612:35)

[ERROR]   An unhandled error occurred while Bolt processed an event
[ERROR]  bolt-app 20 |     ErrorCode["UnknownError"] = "slack_bolt_unknown_error";
21 |     ErrorCode["WorkflowStepInitializationError"] = "slack_bolt_workflow_step_initialization_error";
22 | })(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));
23 | class UnknownError extends Error {
24 |     constructor(original) {
25 |         super(original.message);
             ^
error: JSGlobalProxy is not a constructor
 code: "slack_bolt_unknown_error"

      at new UnknownError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/errors.js:25:9)
      at asCodedError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/errors.js:35:12)
      at handleError (/home/kierank/Documents/Projects/the-old-man/node_modules/@slack/bolt/dist/App.js:612:35)

[ERROR]   An unhandled error occurred while Bolt processed an event

from bolt-js.

seratch avatar seratch commented on July 18, 2024

While developing slack-edge, I found that Socket Mode with Bun's built-in WebSocket implementation doesn't work. Thus, there is no workaround for it.

I am not sure about the JSGlobalProxy error with Request URL settings. Nonetheless, @slack/bolt is specifically designed only for Node.js usage. Therefore, it's not surprising to see such unexpected errors with Bun. If you're thinking of building a production-grade app, I don't recommend using @slack/bolt with Bun. Instead, consider going with either @slack/bolt + Node.js or slack-edge + Node.js/Bun/Deno + Request URL.

from bolt-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.