After a recent update, firebase-tools wants me to set my package.json engines setting to either node 6 or 8. When you set it to 6 it deploys the functions on Node 6 and otherwise Node 8.
With firebase-functions 1.0 the background function signature changed from event
to data, context
. I have migrated all my background functions long ago.
I noticed that according to the @gloud/functions docs (which differs from firebase-functions) you explicitly set the Node deployment target, and the distinction in API between the Node 6 and 8 runtimes is this same event vs data/context signature.
So in @gloud/functions the API change got rolled out in a different way than with firebase-functions.
Wat seems weird is that if I now deploy my firebase-functions with engines set to node 8, I get errors like this:
Cloud function needs to be called with an event parameter.
When I set engines to node 6, it says it is deploying my code on Node.js 6, and everything works as before.
Now that seems to be the opposite of what I would expect!
So I am using the up-to-date background functions API but I can't seem to run them properly on Node.js 8. Something seems to be messed up somewhere. Any clue?
Firebase provides the tools and infrastructure you need to develop your app, grow your user base, and earn money. The Firebase Admin Node. js SDK enables access to Firebase services from privileged environments (such as servers or cloud) in Node. js.
Time Limits60 minutes for HTTP functions. 10 minutes for event-driven functions.
Most of Firebase's APIs are asynchronous. This might be confusing at first: you're making a call, for example to fetch some data from Firestore, but you don't get a result back.
The problem is the version of firebase-functions
needs to be 2.0.0+ for node 8 runtime.
This error message appears in 1.x.x firebase-functions
for me, and is gone after I upgrade it.
Note that firebase-admin
also needs to be 5.13.0+.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With