2

I have been developing this app for quite a long time yet, and after reading the console warning about an outdated version of firebase-functions and that I should upgrade to latest version I finally made the decision to update. Now, even though everything seems to be working properly, I am unable to run npm run build successfully when testing on the emulator, since I get a lot of error messages related to a package inside my node_modules folder.

I am running the local emulator where all the new code is tested before being deployed into production. And this is what these two packages looked like on my package.json file looked before and after updating:

Before

"firebase-admin": "^9.8.0",
"firebase-functions": "^3.22.0",

After

"firebase-admin": "^10.0.2",
"firebase-functions": "^4.0.0",

The problem

After updating, I am unable to successfully run npm run build, and I get a bunch of error related with packages that are inside node_modules. Some of this packages are:

node_modules/@firebase/util/dist/
node_modules/@types/express-serve-static-core
node_modules/firebase-functions/lib/common

And the errors are not that verbose and go something like this:

21 export declare type Extract<Part extends string> = Part extends `{${infer Param}=**}` ? Param : Part extends `{${infer Param}=*}` ? Param : Part extends `{${infer Param}}` ? Param : never;

I'll be attaching a screenshot with some of the errors I'm getting.

What have I Already tried doing

  • Installed latest version of firebase-functions: Updated only firebase-functions with npm install --save firebase-functions@latest inside my functions directory.
  • Installed latest version of firebase-admin: Solved the dependency issue by running npm install --save firebase-admin@latest and by installing latest version of firebase-functions.
    • This solved the conflict but this is where the issues started appearing after running npm run build
    • I also got a bunch of new errors that resulted from the upgrade, but I solved them and everything seems to be working OK.
  • Removed node_modules, package-lock.json: In order to properly re-install dependencies, erased these two files and run npm install, but the problem persisted.
  • Upgraded to specific versions of functions and admin: While diving deeply on this rabbit hole, I noticed that perhaps upgrading to a specific version could help. So I went with firebase-admin@10.0.0 and firebase-functions@4.0.0. But nothing.

So, What am I looking for?

My workflow is as follows:

  • Write new code
  • Run npm run build to see if everything is ok and the app passes the linter test at a quick glance
  • Test code
  • Push Code
  • ...
  • npm run lint before deploy (which passes)
  • Deploy

So, for me npm run build tells me that everything is OK and I can move forward with code. I don't really know if this is necessary or not, but I've been working like this forever. It gives me a safe feeling.

So I want to know why can't I run npm run build, what is causing all these errors that I have nothing to do with, and how can I solve this issue.

I am also afraid that this will impact on the deploy of functions, preventing me from deploying correctly since npm run build is not passing.

My Project settings

  • firebase-functions: 3.20.1
  • firebase-tools: 11.16.1
  • firebase-admin: 10.1.0
  • Language: Typescript
  • Node Version: 14.21.1 (using with nvm)

The screenshot

Errors shown on console after running npm run build

Juan Giacosa
  • 183
  • 1
  • 12
  • How about `firebase-admin : v11.2.1` and `firebase-functions : v4.0.2`? Are you facing same error with latest versions also? – Roopa M Nov 17 '22 at 08:21
  • @RoopaM yes! I didn't mention in the question that in-between trials among different versions I also tried with the latest version of `firebase-admin` and It Doesn't work. – Juan Giacosa Nov 18 '22 at 10:48
  • Can you share your `package.json`? – Roopa M Nov 22 '22 at 09:29

1 Answers1

0

The problem likely due to an outdated version of Typescript. Try upgrading typescript to newer version.

Update theses packages

Narongdej Sarnsuwan
  • 5,095
  • 1
  • 12
  • 10