firebase / firebase-tools

The Firebase Command Line Tools
MIT License
4.01k stars 925 forks source link

punycode deprecation #7476

Closed JasonGoemaat closed 3 weeks ago

JasonGoemaat commented 1 month ago

[REQUIRED] Environment info

firebase-tools: 13.13.3

Platform: Windows 10

node: 22.5.1

[REQUIRED] Test case

Trying to run emulator with this:

$ firebase --project demo-friendly-eats emulators:exec --import ./app-data-seed --ui 'ng serve'
(node:25952) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

[REQUIRED] Steps to reproduce

Tried to run the firestore sample at quickstart firestore following directions. The npm script fails, I think it sees the deprecation as an error. I was able to start it using the previous command manually though.

Reading up a little it seems like the punycode module has been deprecated since node 7, but changed to a runtime warning as of node 21. I'm not sure where the node version

[REQUIRED] Expected behavior

Running with no errors or runtime warnings, running from npm script succeeds.

[REQUIRED] Actual behavior

There is a red runtime warning about punycode being deprecated, and I think it is what prevents the npm script from working:

    "start": "npm run pre-build && firebase --project demo-friendly-eats emulators:exec --import ./app-data-seed --ui 'ng serve'",
JasonGoemaat commented 1 month ago

Took me a while, but found I could set the environment variable using export NODE_OPTIONS=--trace-deprecation to find what package it was coming from:

(node:21852) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
    at node:punycode:3:9
    at BuiltinModule.compileForInternalLoader (node:internal/bootstrap/realm:399:7)
    at BuiltinModule.compileForPublicLoader (node:internal/bootstrap/realm:338:10)
    at loadBuiltinModule (node:internal/modules/helpers:96:7)
    at Module._load (node:internal/modules/cjs/loader:1070:17)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:215:24)
    at Module.require (node:internal/modules/cjs/loader:1304:12)
    at require (node:internal/modules/helpers:123:16)
    at Object.<anonymous> (C:\Users\jason\scoop\persist\nodejs\bin\node_modules\firebase-tools\node_modules\whatwg-url\lib\url-state-machine.js:2:18)
aalej commented 1 month ago

Hey @JasonGoemaat, thanks for reaching out. As you mentioned the deprecation warning you’re seeing is due to the punycode deprecation. At the moment, we’re working on moving all our dependencies to get rid of deprecation warnings such this.

Also, firebase-tools currently does not officially support Node.js 22, I would recommend using Node.js 20.x since this is an LTS version.

Lastly, to make sure we’re on the same page here, could you let me know what behavior was shown when running the command:

$ firebase --project demo-friendly-eats emulators:exec --import ./app-data-seed --ui 'ng serve'

When I tried running this locally, I encountered the deprecation warning but the emulators were able to start. Is this similar to what you observed, or did the emulators not start at all?

I’m using the following to try and reproduce the issue:

google-oss-bot commented 1 month ago

Hey @JasonGoemaat. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

aalej commented 1 month ago

Hey @JasonGoemaat, could you try running the command below to see if you would be able to start the emulator:

firebase --project demo-friendly-eats emulators:exec --import ./app-data-seed --ui "ng serve"

It looks like the reason why the emulators were not able to start is because the command wasn’t able to correctly parse the argument 'ng serve'.

The punycode deprecation warning might not be the cause of the issue, instead it could be related to how cmd treats single quotes.

google-oss-bot commented 3 weeks ago

Hey @JasonGoemaat. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

joehan commented 3 weeks ago

Closing this since the template was fixed and this is a limitation of cmd. The pounycode deprecation warnings are a red herring here.