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

Incopatibile with --enable-source-maps node 12 option #36

Closed
sla100 opened this issue Oct 16, 2019 · 7 comments
Closed

Incopatibile with --enable-source-maps node 12 option #36

sla100 opened this issue Oct 16, 2019 · 7 comments

Comments

@sla100
Copy link

sla100 commented Oct 16, 2019

Try:

node -e "require('depd')('x')()" --enable-source-maps

It catch:

C:\workspace\node_modules\depd\index.js:268
var file = callSite.getFileName() || '<anonymous>'
                    ^

TypeError: callSite.getFileName is not a function
    at callSiteLocation (C:\workspace\npm-server\node_modules\depd\index.js:268:23)
    at depd (C:\workspace\npm-server\node_modules\depd\index.js:109:14)
    at [eval]:1:16
@dougwilson
Copy link
Owner

The --enable-source-maps is still experimental. Usage of it breaks the Error.prepareStackTrace v8 API this module relies on (among other things).

Node.js allows you to hook in with Error.prepareStackTrace global (https://github.com/nodejs/node/blob/cbd8d715b2286e5726e6988921f5c870cbf74127/lib/internal/errors.js#L37) but when you set --enable-source-maps they replace the error stack functionality with something that doesn't do this (https://github.com/nodejs/node/blob/4ca61f40fed31d590e4d624551044fe7cc7efd42/lib/internal/source_map/prepare_stack_trace.js). I would assume this is a bug / accident on their part unless there is something that says otherwise.

I would suggest raising the bug on Node.js based on this.

@dougwilson
Copy link
Owner

Here is a simplified example of the underlying issue:

$ node -e 'Error.prepareStackTrace=()=>console.log("called");new Error().stack'
called
$ node -e 'Error.prepareStackTrace=()=>console.log("called");new Error().stack' --enable-source-maps
$

@dougwilson
Copy link
Owner

nodejs/node#29994

@dougwilson
Copy link
Owner

Keeping open for visibility

@dougwilson dougwilson reopened this Oct 16, 2019
@soda0289
Copy link

soda0289 commented Jan 7, 2020

Fixed in node v13.6.0

@dougwilson Thanks for reporting to nodejs

@sla100
Copy link
Author

sla100 commented Jan 12, 2020

Cum debita reverentia

@sla100 sla100 closed this as completed Jan 12, 2020
@xanonid
Copy link

xanonid commented Jun 16, 2020

Works also meanwhile with recent node v12.x versions (>= v12.16.x).

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

No branches or pull requests

4 participants