I am attempting to deploy a GCP cloud function using the "--env-vars-file" flag and specifying a YAML file to contain the variables. My 'app-dev.yaml' YAML file looks like this:
runtime: python37
api_version: '1'
threadsafe: 'true'
env_variables:
VAR_1: 'var_1_value'
VAR_2: 'var_2_value'
VAR_3: 'var_3_value'
And my gcloud functions deploy looks like this:
gcloud functions deploy my_cloud_function --env-vars-file app-dev.yaml --runtime python37 --trigger-resource my-project.appspot.com --trigger-event google.storage.object.finalize
Now when I run this command I get back this error:
gcloud crashed (ValidationError): Expected type for field value, found {'VAR_1': 'var_1_value', 'VAR_2': 'var_2_value', 'VAR_3': 'var_3_value'} (type
<type 'dict'>
)
But according to this Google example the app-dev.yaml format should be fine.
Any help is appreciated. Thanks
All values must be strings, example:
Wrong value:
VAR_1: 3.1416
Correct value:
VAR_1: "3.1416"
The link you provided refers to the app.yaml
file needed in App Engine and is unrelated.
As per the Cloud Functions doc here, the .env.yaml
file should have the following format:
VAR_1: var_1_value
VAR_2: var_2_value
VAR_3: var_3_value
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