-
Notifications
You must be signed in to change notification settings - Fork 957
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
firebase serve: TypeError: Cannot read properties of undefined (reading 'getTime') #7173
Comments
Hey @Deleplace, thanks for reaching out. I’m trying to reproduce the error you mentioned, but so far, I haven’t encountered any issues with running To help us narrow down what’s causing this, could you let us know which version of Node.js you’re using? I’m using the ff to try and replicate this:
|
Thank you @aalej for this fast reply. I edited the issue to mention I had freshly installed the Firebase CLI using brew. I'm using Node.js v22.1.0 I suspect this specific bug would be easier to reproduce on Linux (filesystem stuff may vary). It is possible the bug is in superstatic, where this line is dereferencing an fs stats time object which happened to be |
Thanks for the additional info, @Deleplace. TIL Node.js 22 was released. I tried switching to Node.js v22.1.0, and I was able to reproduce the error. Opening http://localhost:5000/ shows Since I’m able to reproduce the issue on a macOS machine, I’m guessing that this could be caused by some changes in Node.js. Could you try temporarily switching to Node.js 20.x.x to see if it would workaround the issue? Reading through https://nodejs.org/en/about/previous-releases, it looks like Node.js 20 is still the LTS version, while Node.js 22 is scheduled to become LTS around October 2024. I’ll discuss this with our engineering team to see what we could do to address this. |
Awesome findings @aalej, this is working for me as well! (via brew, not via nvm)
The Brew formula for firebase-cli currently "depends on node 22.2.0", which is maybe not the best for now. |
I'm not sure of the implications, but it seems superstatic's package.json has
while firebase-tools' package.json has
|
Thanks guys, facing the same issue, resolved after reverting node.js back to v20. |
Also happened to me using node v22 in Debian. Downgraded to v20. |
Same on Windows. Fixed by downgrading node from 22 to 20. |
Same on Mac. As i learned on the comments here, fixed by downgrading from node 22 to 20 |
Hey all, I was also facing the same issue. In my case it was a pain to come back of NodeJs version, so literally what I did was to comment line 89 (it's basically a modified timestamp, not a big deal) and started working. Basically commented this line of code:
|
Sorry for only being able to come around to this now. In the short term, we likely will have to change firebase-tools's engines.node to indicate < 22, since we don't support that officially yet (since it's in active development, not stable). In the long term, we'll have to fix this in superstatic. |
Downgrading node version from 22 to 20 and reinstalling firebase-tools after fixed it for me. brew install node@20
brew unlink node
brew link node@20
npm install -g firebase-tools
firebase emulators:start |
the same is happening to me on node20 (and node18 too)
|
Looks like you're still running For me, I had to install firebase a second time in the proper virtual environment. |
For me, "brew install firebase-cli" automatically installs node 22.9 with it, how to get around that in venv? @eddieh |
Personally I hate
Then (not sure I picked the best node version, but it was a recent one with a point release):
Then
etc. Maybe not the most elegant solution, but it is all in the project directory and the rest of my system is unchanged. No new version of node, firebase, or stupid shell functions (nvm, I'm looking at you). |
I was facing the same issue on Windows, solved by downgrading to nodejs 20 using nvm. Install Install version 20: Change to new installed version: Verify current node version being used: Restart the CMD and rerun firebase. |
FYI - People using the latest Node LTS may start experiencing this issue as Node LTS just switched from v20 to v22 (https://github.com/nodejs/Release?tab=readme-ov-file#release-schedule). (My tests just started to fail in Github actions as |
I have a manual solve that keeps the modified time. You have to edit the file in question, and then on line 89 change from:
to
and thus the return statement will look like:
And then recompile/redeploy. |
This was just fixed in superstatic https://github.com/firebase/superstatic/releases/tag/v9.1.0 |
[REQUIRED] Environment info
firebase-tools:
13.8.3
Platform:
Ubuntu 22.04
[REQUIRED] Test case
No project code necessary for repro
[REQUIRED] Steps to reproduce
Then visit http://localhost:5000/ in browser
[REQUIRED] Expected behavior
In browser: a proper welcome page
[REQUIRED] Actual behavior
In browser: "Unexpected error occurred."
The text was updated successfully, but these errors were encountered: