-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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 10.0.0 with ts-node throws a TypeError in isInsideNodeModules when an error is thrown by user code #20258
Comments
Ping @addaleax ... any ideas? |
(heh... it would help if I actually read the entire stack track ... lol...) |
I'm looking into this but anyone else is also welcome to dig in. |
I do have the same issue. Just now upgraded to 10.0.0 from version 8, and all my tests are failing. internal/util.js:360 |
@tirthamazumdar ... are you also using |
@jasnell It just comes with |
@jasnell yes I am also using source-map-support.. Just now compiled typescript into javascript and the running directly the javascript tests the problem goes away. |
Ok, @apapirovski @addaleax ... looks like the transpiler here is mucking around with the generation of the stack frames in a way the check in core did not anticipate. I think we should likely do in this case is have |
Attempting to put together a standalone repo test case now but not having much luck yet. |
@jasnell Here's the simplest possible reproduction:
The error happens because V8 won't call PR coming up. |
Ouch. Yes, that makes sense – thanks for figuring this out so quick. I am surprised though, it might be nice if V8 supported this – after all, the other |
I had seen the |
Not sure I follow. If it's about @apapirovski's test case, what other Error object and VM context? |
|
@bnoordhuis I’m talking about this: Lines 343 to 352 in ad5307f
It’s a different context, and while I get the intention on V8’s side, this does seem surprising; it’s not like it’s recusing into the same |
this requires that an error be thrown to show up at all right? so there's no way we could have picked this up by having anything extra in citgm? breaking TS support is becoming a bigger deal as its adoption spreads. |
I think maybe having https://github.com/evanw/node-source-map-support in there would've caught it? But I haven't checked the test suite. Edit: Yep, would've caught it:
|
Thinking about it more, it's probably not the worst module to add. There are a few less common APIs exercised in their module & test suite. |
@nodejs/citgm ☝️ |
Pull requests welcome over at https://github.com/nodejs/citgm. Please make sure to document in the PR the fulfilled hard and soft requirements met by the module in question as per: https://github.com/nodejs/citgm/blob/master/CONTRIBUTING.md#submitting-a-module-to-citgm |
Okay, I get it now. Wouldn't be terribly hard to fix in V8 at the cost of some additional complexity (tracking the entered contexts.) That said, the goal of Strawman: capture the stack trace with We don't currently record our own script ids but that's relatively straightforward to add. |
Tests fail due to nodejs/node#20258. We can and should re-enable this once that's been released.
This should resolve the current build failures and can be reverted once nodejs/node#20258 is resolved. See #40.
I found related to source-map-support in my broken build : https://travis-ci.org/jy95/mediaScan/jobs/372789737#L517 |
What's the solution? $ node -v TypeError: frame.getFileName is not a function |
V8 only has a single flag for checking whether prepareStackTrace is recursing. Are you saying having the flag per context or stored on the prepareStackTrace function itself would solve this? @schuay |
When isInsideNodeModules gets called while already processing another stack trace, V8 will not call prepareStackTrace again. This used to cause Node.js to just crash — fix it by checking for expected return type of the stack (Array). PR-URL: #20266 Fixes: #20258 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
@yoav-zibin 10.1.0 should come out soon and have a fix for it. |
Just upgraded, can confirm that after upgrading to 10.1.0 everything works alright on our machines. |
Attached sample project (which is a single ts file with just
throw new Error()
) when run vianpm start
fails with:repro-nodejs-10-throw.zip
The text was updated successfully, but these errors were encountered: