-
Notifications
You must be signed in to change notification settings - Fork 29.9k
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
Node 20: errors with util.inspect.custom raised in loader thread not serialized/deserialized correctly #48207
Comments
The title says "loader thread", but I assume that's true for any worker thread, right? |
One of the issues seems specific to the error handling code in process/esm_loader. Others seem to affect all error serialisation. |
Can you share a minimal repro? |
@aduh95 would the repro I made for |
A minimal repro would ideally not include any code to be downloaded from the internet, ideally a list of commands that can be copy pasted from the web browser to a terminal. |
I've opened #48306 to address this.
It has nothing to do with the custom inspect method, Lines 1005 to 1017 in 6700aac
You forgot I'm not sure what this ticket is about, could you please share a minimal repro that includes steps to reproduce the issue (without needing to download code from the internet), the expected output, and what you see instead please? |
PR-URL: nodejs#48306 Fixes: nodejs#48207 Reviewed-By: James M Snell <jasnell@gmail.com>
PR-URL: nodejs#48306 Fixes: nodejs#48207 Reviewed-By: James M Snell <jasnell@gmail.com>
Pointless issue. Still receive an error and only this output:
|
Getting the same error on node 20. If I change it to mjs it runs perfectly, but for some reason it just can't run in esm loader. Tested in both node 18 and 20. Changing this in tsconfig.json seems to fixed the issue for me (shows actual error)
|
Using |
I had similar error: |
I have the same error when i run Cypress in my project. It doesn't want to open and when it runs i get this error: node:internal/modules/run_main:129
triggerUncaughtException(
^
[Object: null prototype] {
[Symbol(nodejs.util.inspect.custom)]: [Function: [nodejs.util.inspect.custom]]
} No tsconfig options solved this issue. Any resloves yet on this? I tried to run in Node 18 and 20 but the same problem. here are the dependencies:
|
Version
v20.2.0
Platform
No response
Subsystem
No response
What steps will reproduce the bug?
Throw an error with a custom inspect symbol in worker thread, which is then serialised and deserialised to be displayed by main thread.
Investigating a bug in
ts-node
(TypeStrong/ts-node#2026) I ran into some issues with how errors in (loader) worker threads are handled.util.inspect.custom
is only checked in own properties (https://github.com/nodejs/node/blob/main/lib/internal/error_serdes.js#L137), ignoring it if the error was created using a class constructor (see https://github.com/TypeStrong/ts-node/blob/7af5c48864b60576e471da03c064f325ce37d850/src/index.ts#L432-L464)internalBinding('errors').triggerUncaughtException
How often does it reproduce? Is there a required condition?
Every time an error is raised in loader worker thread.
What is the expected behavior? Why is that the expected behavior?
Errors using custom inspect symbol raised in threads should serialise correctly
What do you see instead?
Additional information
No response
The text was updated successfully, but these errors were encountered: