Closed scarf005 closed 1 year ago
Hey @scarf005 👋🏻 Super cool to see that you're experimenting with Deno and Bolt JS 🎉
⚠️ This is new territory and we haven't started to test Bolt JS compatibility with Deno. In the earlier days, before official Deno/npm compatibility, we had issues with some of our dependencies such as axios.
Similar to you, I had trouble getting the dereferencing syntax to work: import { App } from "npm:@slack/bolt"
My workaround was to import the entire module and reference the App
object. It's not ideal, but it's a step forward:
import bolt from "npm:@slack/bolt"
// ...
const app = new bolt.App({
Unfortunately, I'm now seeing a new error and I'm unsure where it's coming from. Do you experience the same error?
$ deno run --allow-read --allow-env main.ts
error: Uncaught TypeError: The "path" argument must be of type string. Received undefined
at assertPath (ext:deno_node/path/_util.ts:8:15)
at basename (ext:deno_node/path/posix.ts:202:5)
at Object.<anonymous> (file:///Users/michael.brooks/Library/Caches/deno/npm/registry.npmjs.org/@slack/web-api/6.8.1/dist/instrument.js:44:28)
at Object.<anonymous> (file:///Users/michael.brooks/Library/Caches/deno/npm/registry.npmjs.org/@slack/web-api/6.8.1/dist/instrument.js:66:4)
at Module._compile (ext:deno_node_loading/02_require.js:745:34)
at Object.Module._extensions..js (ext:deno_node_loading/02_require.js:778:10)
at Module.load (ext:deno_node_loading/02_require.js:656:32)
at Function.Module._load (ext:deno_node_loading/02_require.js:513:12)
at Module.require (ext:deno_node_loading/02_require.js:678:19)
at require (ext:deno_node_loading/02_require.js:818:16)
I recall experimenting in this area a while ago, and I left some TODOs related to this in the web-api
code.
If I understand correctly, @mwbrooks' stack trace points to the basename
invocation here, and the argument being provided to it (process.title
) is not an API deno implements - thus, undefined
.
I did prior work in this area, but couldn't get all the way to full compatibility - at least in the dependent web-api
module (which is revisioned on github.com/slackapi/node-slack-sdk/packages/web-api and bolt relies on). There is a dedicated npm run build:deno
run script that tries to build a deno-compatible version of web-api
and fill in some of these gaps - like assigning values to process.title
and injecting some of the deno shims I put together. We even had a GitHub Action that would run through this build and deploy the web-api client out to deno.land under slack_web_api - but we removed it a while back as a) it didn't have full feature support due to some missing system APIs from deno (like proxying support) and b) we didn't know whether there would be much interest in it.
@filmaj I just ran into this trying to consume @slack/web-api using the npm specifier in deno.
error: Uncaught TypeError: The "path" argument must be of type string. Received undefined
at assertPath (ext:deno_node/path/_util.ts:8:15)
at basename (ext:deno_node/path/posix.ts:202:5)
at Object.<anonymous> (file:///Users/hardeep/Library/Caches/deno/npm/registry.npmjs.org/@slack/web-api/6.8.1/dist/instrument.js:46:28)
at Object.<anonymous> (file:///Users/hardeep/Library/Caches/deno/npm/registry.npmjs.org/@slack/web-api/6.8.1/dist/instrument.js:69:4)
at Module._compile (ext:deno_node_loading/02_require.js:745:34)
at Object.Module._extensions..js (ext:deno_node_loading/02_require.js:778:10)
at Module.load (ext:deno_node_loading/02_require.js:656:32)
at Function.Module._load (ext:deno_node_loading/02_require.js:513:12)
at Module.require (ext:deno_node_loading/02_require.js:678:19)
at require (ext:deno_node_loading/02_require.js:818:16)
Is the best path forward to use the build script?
Ohai @hardeep 😄
I believe that is the case, yes. the npm:
specifier in deno should try to put in place a lot of these node compatibility shims that deno is working on automatically but depending on the API, the compatibility shim might not be available.
You may have to fudge around with the build script a bit as the manual shims I put into place may be no longer needed or need tweaking, but the general gist of the approach should continue to work.
Another option is to give the deno-slack-api repo a shot. It is an API client built for deno, BUT, it has a very minimal feature set compared to @slack/web-api
: no automatic retry, no proxy support, and many other things.
👋 It looks like this issue has been open for 30 days with no activity. We'll mark this as stale for now, and wait 10 days for an update or for further comment before closing this issue out. If you think this issue needs to be prioritized, please comment to get the thread going again! Maintainers also review issues marked as stale on a regular basis and comment or adjust status if the issue needs to be reprioritized.
As this issue has been inactive for more than one month, we will be closing it. Thank you to all the participants! If you would like to raise a related issue, please create a new issue which includes your specific details and references this issue number.
Hi @filmaj, thanks for the insights. Following up on the discussion, are there any future plans to add deno support to bolt?
@myftija not at this time, though Deno has ever-improving compatibility with npm packages / node ecosystem, so at some point bolt should "just work" for deno.
Hey @scarf005 👋🏻 Super cool to see that you're experimenting with Deno and Bolt JS 🎉
⚠️ This is new territory and we haven't started to test Bolt JS compatibility with Deno. In the earlier days, before official Deno/npm compatibility, we had issues with some of our dependencies such as axios.
Similar to you, I had trouble getting the dereferencing syntax to work:
import { App } from "npm:@slack/bolt"
My workaround was to import the entire module and reference the
App
object. It's not ideal, but it's a step forward:import bolt from "npm:@slack/bolt" // ... const app = new bolt.App({
Unfortunately, I'm now seeing a new error and I'm unsure where it's coming from. Do you experience the same error?
$ deno run --allow-read --allow-env main.ts error: Uncaught TypeError: The "path" argument must be of type string. Received undefined at assertPath (ext:deno_node/path/_util.ts:8:15) at basename (ext:deno_node/path/posix.ts:202:5) at Object.<anonymous> (file:///Users/michael.brooks/Library/Caches/deno/npm/registry.npmjs.org/@slack/web-api/6.8.1/dist/instrument.js:44:28) at Object.<anonymous> (file:///Users/michael.brooks/Library/Caches/deno/npm/registry.npmjs.org/@slack/web-api/6.8.1/dist/instrument.js:66:4) at Module._compile (ext:deno_node_loading/02_require.js:745:34) at Object.Module._extensions..js (ext:deno_node_loading/02_require.js:778:10) at Module.load (ext:deno_node_loading/02_require.js:656:32) at Function.Module._load (ext:deno_node_loading/02_require.js:513:12) at Module.require (ext:deno_node_loading/02_require.js:678:19) at require (ext:deno_node_loading/02_require.js:818:16)
I am getting this error importing this package in Stackblitz. Any ideas on this??
hello, today i tried using bolt-js in deno, however it does not seem to work.
when i change the import to
import * as bolt from "npm:@slack/bolt"
, i get this instead:could it be possible for bolt-js to support deno? thank you for your time.