I’m trying to deploy a Firestore 2nd gen functions with command firebase deploy --only functions
but I got a error:
There was an issue deploying your functions. Verify that your project has a Google App Engine instance setup at https://console.cloud.google.com/appengine and try again. If this issue persists, please contact support.
⚠ functions: Upload Error: HTTP Error: 400, Could not create bucket gcf-v2-uploads-758827227995-us-central1. 'us-central1' violates constraint 'constraints/gcp.resourceLocations'
Error: HTTP Error: 400, Could not create bucket gcf-v2-uploads-758827227995-us-central1. 'us-central1' violates constraint 'constraints/gcp.resourceLocations'
According with a [documentation] (https://firebase.google.com/docs/functions/locations#best_practices_for_changing_region) use just:
exports.myStorageFunction = functions
.region('europe-west1')
.storage
.object()
.onFinalize((object) => {
// ...
});
How I can do in Python? my function was written in Python.
2
Answers
use the region property in the firebase.functions.config()
This will deploy your function to the us-central1 region. You can also use the location property to deploy your function to a specific location within a region
you do not specify a region, your function will be deployed to this
region.
Using this documentation as reference, you can define runtime options in the arguments of functions decorator. If you’re trying to set the region for a Firebase Cloud Function written in Python, you can try specifying the region in the functions decorator like so:
If you’re configuring a Cloud Firestore trigger(e.g.
on_document_created
), it would look like: