Giter Club home page Giter Club logo

Comments (10)

dougwilson avatar dougwilson commented on July 4, 2024

Hi @loynoir thanks for reporting! As far as I am aware, all versions of Node.js have that function, and also the error looks weird and there is no stack trace. Can you help by providing the following information?

  1. Version of Node.js you are running this module on
  2. Version of this module you are running

Thank you!

from nodejs-depd.

loynoir avatar loynoir commented on July 4, 2024
"depd": "^2.0.0"
$ node --frozen-intrinsics
Welcome to Node.js v16.18.0.
> require('depd')('http-errors')('non-error status code; use only 4xx or 5xx status codes')
Uncaught:
TypeError <Object <Object <[Object: null prototype] {}>>>: callSite.getFileName is not a function
    at callSiteLocation (/path/to/node_modules/.pnpm/[email protected]/node_modules/depd/index.js:268:23)
    at depd (/path/to/node_modules/.pnpm/[email protected]/node_modules/depd/index.js:109:14)
$ node --frozen-intrinsics
Welcome to Node.js v18.12.0.
> require('depd')('http-errors')('non-error status code; use only 4xx or 5xx status codes')
Uncaught:
TypeError <Object <Object <[Object: null prototype] {}>>>: callSite.getFileName is not a function
    at callSiteLocation (/path/to/node_modules/.pnpm/[email protected]/node_modules/depd/index.js:268:23)
    at depd (/path/to/node_modules/.pnpm/[email protected]/node_modules/depd/index.js:109:14)

from nodejs-depd.

dougwilson avatar dougwilson commented on July 4, 2024

Oh, I see now, it's something to do with --frozen-intrinsics (https://nodejs.org/dist/latest-v18.x/docs/api/cli.html#--frozen-intrinsics). It seems that is experimental and your output should be having an experimental warning. Weird that you're not seeing that warning. But I can look into what it would take to support that environment, though since it's experimental not sure on what I can promise around that, as experimental features of Node.js change often which makes them hard to support correctly.

from nodejs-depd.

loynoir avatar loynoir commented on July 4, 2024

Ah I delete that warning, I guess easier to read.

$ pnpm node --frozen-intrinsics
(node:6252) ExperimentalWarning: The --frozen-intrinsics flag is experimental
(Use `node --trace-warnings ...` to show where the warning was created)
Welcome to Node.js v18.12.0.
Type ".help" for more information.
> require('depd')('http-errors')('non-error status code; use only 4xx or 5xx status codes')
Uncaught:
TypeError <Object <Object <[Object: null prototype] {}>>>: callSite.getFileName is not a function
    at callSiteLocation (/path/to/node_modules/.pnpm/[email protected]/node_modules/depd/index.js:268:23)
    at depd (/path/to/node_modules/.pnpm/[email protected]/node_modules/depd/index.js:109:14)

from nodejs-depd.

dougwilson avatar dougwilson commented on July 4, 2024

Ah. But yea, as the Node.js docs state:

Code may break under this flag.

I'll take a look into what it would take to support that and see how the flag varies across the Node.js versions released so far to get a hint at future direction of the experimental feature too. For now, I would suggest not using that feature if you want to use this module.

from nodejs-depd.

loynoir avatar loynoir commented on July 4, 2024

nodejs/node#45336 (comment)

from nodejs-depd.

dougwilson avatar dougwilson commented on July 4, 2024

I'm not sure what that link means.

from nodejs-depd.

loynoir avatar loynoir commented on July 4, 2024

There is nodejs contributor suggestion, maybe, to use that flag to protect prototype pollution instead of crashed Object.freeze(NODE_GLOBAL_AND_ITS_PROTOTYPE).

from nodejs-depd.

dougwilson avatar dougwilson commented on July 4, 2024

Ah. But yea, like I pointed out, the Node.js documentation for --frozen-intrinsics (https://nodejs.org/dist/latest-v18.x/docs/api/cli.html#--frozen-intrinsics) specifically states the following:

Code may break under this flag.

And it looks like indeed, this code does break under that flag. Node.js seems well aware you're going to run into issues with that experimental feature. Like I said, I will look into what it would take to work with that flag, if it is even possible. But it is experimental and as Node.js states:

Stability: 1 - Experimental. The feature is not subject to semantic versioning rules. Non-backward compatible changes or removal may occur in any future release. Use of the feature is not recommended in production environments.

I will try my best to support it, but supporting experimental features are hard by their nature of random changes without concern for breaking things.

from nodejs-depd.

loynoir avatar loynoir commented on July 4, 2024

Ah, have a look where is the first place goes wrong when using that flag.

Error.prepareStackTrace = prepareObjectStackTrace

So, this seems related to #16

with --frozen-intrinsics

> Error.prepareStackTrace = ()=>{}
[Function (anonymous)] Function <Function <[Object: null prototype] {}>>
> Error.prepareStackTrace
undefined

from nodejs-depd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.