首页 > 解决方案 > iam.gserviceaccount.com 没有 storage.buckets.get 访问权限

问题描述

我正在尝试使用气流 DAG 任务将文件存储到 GCS 中。我在气流连接页面的“keyfile json”字段中指定了我的服务帐户信息。但是,当 dag 运行时,即使 GCP 服务帐户具有“存储对象管理员”角色,我也会收到权限错误:

错误 - 403 获取https://www.googleapis.com/storage/v1/b/weather_api?projection=noAcl:airflow@xstack-developers-237307.iam.gserviceaccount.com 没有 storage.buckets.get 访问 weather_api。回溯(最后一次调用):文件“/Users/bilguun/env/lib/python3.7/site-packages/airflow/models/taskinstance.py”,第 922 行,在 _run_raw_task 结果 = task_copy.execute(context=context ) 文件“/Users/bilguun/env/lib/python3.7/site-packages/airflow/operators/python_operator.py”,第 113 行,在执行 return_value = self.execute_callable() 文件“/Users/bilguun/env/ lib/python3.7/site-packages/airflow/operators/python_operator.py”,第 118 行,在 execute_callable 中返回 self.python_callable(*self.op_args, **self.op_kwargs) 文件“/Users/bilguun/airflow/dags /dag_1.py",第 44 行,在 forecast_to_gcs 模式 = json.loads(gcs_hook.download(gcs_bucket, '

我多次检查了我的服务帐户的角色,它说:“存储对象管理员”

以前有人遇到过这个问题吗?

标签: airflowgoogle-authentication

解决方案


推荐阅读