node-slack-sdk icon indicating copy to clipboard operation
node-slack-sdk copied to clipboard

Better compatibility with source-map-support

Open gajus opened this issue 4 years ago • 6 comments
trafficstars

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.

gajus avatar Nov 20 '20 15:11 gajus

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?

aoberoi avatar Nov 20 '20 23:11 aoberoi

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.

Kapture 2020-11-20 at 17 09 35

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)?

aoberoi avatar Nov 21 '20 01:11 aoberoi

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.

gajus avatar Nov 22 '20 16:11 gajus

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).

seratch avatar May 06 '21 05:05 seratch

👋 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.

github-actions[bot] avatar Dec 05 '21 00:12 github-actions[bot]

It's a shame that a company like Slack does not invest time in properly shipping SDK's...

sergio-toro avatar Mar 07 '24 14:03 sergio-toro