mrdulin / blog

Personal Blog - 博客 | 编程技术,软件,生活

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

使用gcloud sdk部署Cloud Function时出现 ERROR: gcloud crashed (AttributeError): 'str' object has no attribute 'items'

mrdulin opened this issue · comments

使用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语法错误,环境变量KeyValue之间没有空格。修改后正确的.env.yaml文件如下:

POSTGRES_INSTANCE_CONNECTION_NAME: xxx
POSTGRES_USER: xxx
POSTGRES_PASSWORD: xxx
POSTGRES_DB: xxx

参考文档


Flag Counter