Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What steps occur when you deploy to firebase functions?

When deploying to firebase functions, I had an error occur during post-install script due to missing dependency. I'll be honest that I was surprised it was even being run. I've come to the realization I don't really understand what gets run during deployment.

I suspect it's something like:

npm install --production
npm run build

The issue I'm having is that it cannot find a dependency for post-install, which i suspect it's not installing dev dependencies.

Are there are a list of things that occur when you push to firebase functions?

like image 979
nobgdeal Avatar asked Sep 06 '25 14:09

nobgdeal


1 Answers

As explained in Google Cloud Functions Node documentation, at least this is what they mention:

When you deploy your function, Cloud Functions installs dependencies declared in the package.json file using the npm install command:

npm install --production

And then:

After you deploy, you can perform a custom build step during the function build process by adding a gcp-build script in your package.json file.

When this script is executed, the dependencies in the dependencies and devDependencies fields of your package.json file are available. After executing your custom build step, Cloud Functions removes and regenerates the node_modules folder by only installing the production dependencies declared in the dependencies field of your package.json file.

If there is no gcp-build script in package.json, Cloud Functions just installs production dependencies.

I'm sure I'm missing some steps, but the gcp-build script was pretty useful to me.

like image 113
maganap Avatar answered Sep 13 '25 10:09

maganap