I have a Firebase project which uses a mix of Cloud Functions 1st Gen and Cloud Functions 2st Gen.
I recently updated both the Firebase CLI and SDK with the following commands
npm install firebase-functions@latest firebase-admin@latest --save
as advised in the Cloud Functions documentation and now I get the following error when deploying:
TypeError: functions.region is not a function
How to solve this problem?
Since the default entry point changed from v1 to v2 and there's no gen2 versions of onCreate()
and onDelete()
you'll have to change your import to now explicity pull in v1 for onCreate()
i.e. change import * as functions from 'firebase-functions'
to import * as functions from 'firebase-functions/v1'
.
See https://github.com/firebase/firebase-functions/issues/1383 for more details.
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