I successfully managed to deploy my https.onCall()
cloud functions on a specific server location with
functions.region("europe-west6")
.https.onCall((data, context) => ...
But when I tried to specify a location for scheduled function:
exports.getItems = functions.pubsub.schedule('0 6 * * *')
.region("europe-west6")
.timeZone('Europe/Zurich')
.onRun(async (context) => {
I receive:
TypeError: functions.pubsub.schedule(...).region is not a function
I wonder if this functionality (defining custom deploy region) is not available for scheduled functions...
(btw deploying the scheduled function worked without the .region()
parameter)
CodePudding user response:
The .region()
exists on imported functions
SDK itself and not on the ScheduleBuilder returned by .schedule()
, try this:
exports.getItems = functions.region("europe-west6")
// after .region(''), similar to the HTTP function
.pubsub.schedule('0 6 * * *')
.timeZone('Europe/Zurich')
.onRun(async (context) => {
})