node-slack-sdk
node-slack-sdk copied to clipboard
Better compatibility with source-map-support
Description
At the moment NPM packages do not include ./src.
ls -lah node_modules/@slack/web-api
total 48
drwxr-xr-x 5 gajus staff 160 Oct 24 19:50 ./
drwxr-xr-x 5 gajus staff 160 Oct 24 19:50 ../
-rw-r--r-- 1 gajus staff 17209 Oct 26 1985 README.md
drwxr-xr-x 34 gajus staff 1088 Oct 24 19:50 dist/
-rw-r--r-- 1 gajus staff 3100 Oct 24 19:50 package.json
This is a problem, because if I get a stack trace such as the one below:
Error: A rate-limit has been reached, you may retry this request in 1 seconds
at Object.rateLimitedErrorWithDelay (/Users/gajus/Documents/dev/[..]/node_modules/@slack/web-api/src/errors.ts:107:5)
at /Users/gajus/Documents/dev/[..]/node_modules/@slack/web-api/src/WebClient.ts:323:36
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at run (/Users/gajus/Documents/dev/[..]/node_modules/p-queue/dist/index.js:163:29) {
code: 'slack_webapi_rate_limited_error',
retryAfter: 1
}
Then I cannot just click-through to the code to see what is causing the underlying issue.
That's interesting. I would have thought the stack frames would reference files in dist/, which you should be able to click into. That may not be actually what you'd like, if you'd rather see the TypeScript input instead of the build output, but at least it would work. I'll try to reproduce this.
Are you interested in seeing the TypeScript source? If so, we'd need to make sure sourcemapping is wired up correctly and we'd need to ship the src directory in the distribution. This would be a tradeoff with bundle size. Are there any best practices for allowing smaller bundles as well as allowing folks to opt-in to the debugging with the source?
I wasn't able to reproduce this problem. My stack trace is showing files in dist, and in the VSCode terminal, I can "click through" to the source file in dist.

Is there any other build tool processing your source code that might have contributed to this problem? Any info you can give us about your environment (node version, editor, etc)?
The reason my stack trace includes ./src is because babel-node uses https://www.npmjs.com/package/source-map-support. This automatically resolves stack trace to point to the original source codes.
I've updated the labels for this task. Although our team is not actively working on this, contributions are always welcome (as long as it does not bring any breaking changes).
👋 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.
It's a shame that a company like Slack does not invest time in properly shipping SDK's...