I'm trying to deploy a cloud function via my local terminal. For this i use the following code:
gcloud beta functions deploy networkcheck \
--region=europe-west1 \
--project=project-id \
--entry-point functionName \
--trigger-event providers/cloud.firestore/eventTypes/document.write \
--trigger-resource projects/project-id/databases/(default)/documents/test/test_id \
--runtime nodejs8
This will result in the following error:
deploy.sh: line 7: syntax error near unexpected token `('
deploy.sh: line 7: ` --trigger-resource projects/project-id/databases/(default)/documents/test/test_id \'
The script executes perfectly fine when i change '(default)' to 'default or any other string'. But then the cloud function will not work, because the only id that can be used for an Firestore database is '(default)', as mentioned in this post: How to find the database id of a cloud firestore project?
Is this a bug? Or can i fix this somehow?
Parenthesis are special characters in the bash command shell. You will need to escape them so they are taken literally, instead of being interpreted by your shell. Here, I am just putting the --trigger-resource parameter
in single quotes so the parenthesis won't have a special meaning:
--trigger-resource "projects/project-id/databases/(default)/documents/test/test_id"
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