So I know that this question has been asked quite a lot, and the common answer is adding a region like this:
export.webhookEurope = functions
.region('europe-west1')
.https.onRequest((req, res) => {
res.send("Hello");
});
But in my case, I'm working with the onCreate method, and sampling the above code in my function just throws me an error. Code looks like this.
export const onCreate = functions.firestore
.document('parent/{id}')
.region('europe-west1')
.onCreate(async (snapshot, context) => {
// some code which deploys correctly if I leave out the 'region'
});
So deploying without the 'region' part works fine, but if I leave it in, it gives me the following error:
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: `tsc`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Error: functions predeploy error: Command terminated with non-zero exit code2
So what would be the correct way of changing the default region?