使用gcloud sdk部署Cloud Function时出现 ERROR: gcloud crashed (AttributeError): 'str' object has no attribute 'items'
mrdulin opened this issue · comments
official_dulin commented
使用gcloud sdk部署Cloud Function时,出现如下错误:
ERROR: gcloud crashed (AttributeError): 'str' object has no attribute 'items'
If you would like to report this issue, please run the following command:
gcloud feedback
To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
部署脚本如下:
#!/bin/bash
function=PostgresDemo
gcloud functions deploy ${function} --runtime go111 --trigger-http --memory=128 --env-vars-file .env.yaml
原因是环境变量文件.env.yaml
的语法错误,.env.yaml
如下:
POSTGRES_INSTANCE_CONNECTION_NAME:xxx
POSTGRES_USER:xxx
POSTGRES_PASSWORD:xxx
POSTGRES_DB:xxx
yaml
语法错误,环境变量Key
与Value
之间没有空格。修改后正确的.env.yaml
文件如下:
POSTGRES_INSTANCE_CONNECTION_NAME: xxx
POSTGRES_USER: xxx
POSTGRES_PASSWORD: xxx
POSTGRES_DB: xxx