Skip to content

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

@mrdulin

Description

@mrdulin

使用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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions