Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong stack traces for errors #1202

Closed
ionTea opened this issue Apr 21, 2023 · 4 comments · Fixed by #1206
Closed

Wrong stack traces for errors #1202

ionTea opened this issue Apr 21, 2023 · 4 comments · Fixed by #1206

Comments

@ionTea
Copy link

ionTea commented Apr 21, 2023

I have more than one Ably client in my application, and when one of them has an error the stack trace indicates the wrong client had the issue.

Here's an error message that seem to indicate that it originated from a client created in realtime-data/real-time-data-provider/realtime-data-provider

ly-commonjs.js:1155 Uncaught (in promise) Error: Connection closed
    at new ErrorInfo (ably-commonjs.js:1155:1)
    at ErrorInfo.fromValues (ably-commonjs.js:1184:1)
    at Object.eval (ably-commonjs.js:4861:1)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at Object.eval (ably-commonjs.js:5314:47)
    at Object.eval (ably-commonjs.js:6952:29)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at Object.eval (ably-commonjs.js:11773:51)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at Object.eval (ably-commonjs.js:11610:44)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at Object.eval (ably-commonjs.js:10984:42)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at eval (ably-commonjs.js:102:18)
    at eval (ably-commonjs.js:105:1)
    at webpackUniversalModuleDefinition (ably-commonjs.js:11:1)
    at eval (ably-commonjs.js:18:2)
    at ../node_modules/.pnpm/ably@1.2.39/node_modules/ably/build/ably-commonjs.js (_app.js?ts=1682068262972:13832:1)
    at options.factory (webpack.js?ts=1682068262972:740:31)
    at __webpack_require__ (webpack.js?ts=1682068262972:37:33)
    at fn (webpack.js?ts=1682068262972:395:21)
    at eval (ably-client.ts:5:62)
    at ./realtime-data/ably-client.ts (_app.js?ts=1682068262972:20873:1)
    at options.factory (webpack.js?ts=1682068262972:740:31)
    at __webpack_require__ (webpack.js?ts=1682068262972:37:33)
    at fn (webpack.js?ts=1682068262972:395:21)
    at eval (realtime-data-provider.tsx:15:97)
    at ./realtime-data/real-time-data-provider/realtime-data-provider.tsx (_app.js?ts=1682068262972:20939:1)
    at options.factory (webpack.js?ts=1682068262972:740:31)
    at __webpack_require__ (webpack.js?ts=1682068262972:37:33)
    at fn (webpack.js?ts=1682068262972:395:21)
    at eval (index.ts:6:132)
    at ./realtime-data/real-time-data-provider/index.ts (_app.js?ts=1682068262972:20906:1)
    at options.factory (webpack.js?ts=1682068262972:740:31)
    at __webpack_require__ (webpack.js?ts=1682068262972:37:33)
    at fn (webpack.js?ts=1682068262972:395:21)
    at eval (use-channel.tsx:9:109)
    at ./realtime-data/use-channel.tsx (_app.js?ts=1682068262972:20961:1)
    at options.factory (webpack.js?ts=1682068262972:740:31)
    at __webpack_require__ (webpack.js?ts=1682068262972:37:33)
    at fn (webpack.js?ts=1682068262972:395:21)
    at eval (types.ts:6:97)
    at ./realtime-data/types.ts (_app.js?ts=1682068262972:20950:1)
    at options.factory (webpack.js?ts=1682068262972:740:31)
    at __webpack_require__ (webpack.js?ts=1682068262972:37:33)
    at fn (webpack.js?ts=1682068262972:395:21)
    at eval (index.ts:7:91)
    at ./realtime-data/index.ts (_app.js?ts=1682068262972:20895:1)
    at options.factory (webpack.js?ts=1682068262972:740:31)
    at __webpack_require__ (webpack.js?ts=1682068262972:37:33)
E

However, by removing that client and repeating the steps to get the Error, I get the error again but with a different stack trace:

ly-commonjs.js:1155 Uncaught (in promise) Error: Connection closed
    at new ErrorInfo (ably-commonjs.js:1155:1)
    at ErrorInfo.fromValues (ably-commonjs.js:1184:1)
    at Object.eval (ably-commonjs.js:4861:1)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at Object.eval (ably-commonjs.js:5314:47)
    at Object.eval (ably-commonjs.js:6952:29)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at Object.eval (ably-commonjs.js:11773:51)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at Object.eval (ably-commonjs.js:11610:44)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at Object.eval (ably-commonjs.js:10984:42)
    at __nested_webpack_require_723__ (ably-commonjs.js:38:1)
    at eval (ably-commonjs.js:102:18)
    at eval (ably-commonjs.js:105:1)
    at webpackUniversalModuleDefinition (ably-commonjs.js:11:1)
    at eval (ably-commonjs.js:18:2)
    at ../node_modules/.pnpm/ably@1.2.39/node_modules/ably/build/ably-commonjs.js (%5BliveSessionId%5D.js?ts=1682068428026:105:1)
    at options.factory (webpack.js?ts=1682068428026:740:31)
    at __webpack_require__ (webpack.js?ts=1682068428026:37:33)
    at fn (webpack.js?ts=1682068428026:395:21)
    at eval (ably.ts:8:62)
    at ./collaboration/ably.ts (%5BliveSessionId%5D.js?ts=1682068428026:159:1)
    at options.factory (webpack.js?ts=1682068428026:740:31)
    at __webpack_require__ (webpack.js?ts=1682068428026:37:33)
    at fn (webpack.js?ts=1682068428026:395:21)
    at eval (utils.tsx:8:90)
    at ./components/liveV2/summary/utils.tsx (%5BliveSessionId%5D.js?ts=1682068428026:1017:1)
    at options.factory (webpack.js?ts=1682068428026:740:31)
    at __webpack_require__ (webpack.js?ts=1682068428026:37:33)
    at fn (webpack.js?ts=1682068428026:395:21)
    at eval (index.tsx:19:104)
    at ./components/liveV2/summary/index.tsx (%5BliveSessionId%5D.js?ts=1682068428026:962:1)
    at options.factory (webpack.js?ts=1682068428026:740:31)
    at __webpack_require__ (webpack.js?ts=1682068428026:37:33)
    at fn (webpack.js?ts=1682068428026:395:21)
    at eval (session-summary.tsx:22:98)
    at ./components/liveV2/session-summary.tsx (%5BliveSessionId%5D.js?ts=1682068428026:940:1)
    at options.factory (webpack.js?ts=1682068428026:740:31)
    at __webpack_require__ (webpack.js?ts=1682068428026:37:33)
    at fn (webpack.js?ts=1682068428026:395:21)
    at eval (live-layer-page-wrapper.tsx:25:106)
    at ./components/liveV2/live-layer-page-wrapper.tsx (%5BliveSessionId%5D.js?ts=1682068428026:555:1)
    at options.factory (webpack.js?ts=1682068428026:740:31)
    at __webpack_require__ (webpack.js?ts=1682068428026:37:33)
    at fn (webpack.js?ts=1682068428026:395:21)
    at eval (live-session.tsx:25:114)
    at ./views/liveV2/live-session.tsx (%5BliveSessionId%5D.js?ts=1682068428026:1622:1)
    at options.factory (webpack.js?ts=1682068428026:740:31)
    at __webpack_require__ (webpack.js?ts=1682068428026:37:33)
E

This one hinted at the correct Ably client being the source of the error, created in ./collaboration/ably.ts

I don't understand how this can even happen, are multiple Ably clients not isolated from each other?

@sync-by-unito
Copy link

sync-by-unito bot commented Apr 21, 2023

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3550

@owenpearson
Copy link
Member

Hey @ionTea, thank for reaching out!

This certainly looks odd to me, although it's hard to make sense of those stack traces. Would it be possible to share a minimal reproduction or give us some more information about your webpack config and which version of webpack you're using?

There are a few minor singleton classes used within ably-js but I'm fairly sure this is unrelated so I'm wondering if the root cause here is a weird side-effect of some webpack optimisation

@ionTea
Copy link
Author

ionTea commented Apr 24, 2023

@owenpearson
Copy link
Member

@ionTea, that's perfect, thanks!

After testing against your example repo I found that the underlying issue was that this particular error, along with a few others, is being initialised upon importing the library and therefore its stack trace was being created as soon as the library is first imported. I guess in your case, component-one.ts was consistently getting there first. I've created #1206 to fix this and will include it in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants