我用命令注册了数据流:gcloud deployment-manager type-providers create dataflow --descriptor-url='https://dataflow.googleapis.com/$discovery/rest?version=v1b3'
当我运行这个脚本时
- name: "my-topic-to-avro"
type: 'project_id/dataflow:dataflow.projects.locations.templates.launch'
properties:
projectId: project_id
gcsPath: "gs://test-create-123"
jobName: "my-topic-to-avro"
location: "europe-west1"
parameters:
inputTopic: "projects/project_id/topics/test"
outputDirectory: "gs://test-create-123/"
avroTempDirectory: "gs://test-create-123/"在输出中,我有这样的输出:
ERROR: (gcloud.beta.deployment-manager.deployments.update) Error in Operation [operation-1598980583c2a0ec69]: errors:
- code: RESOURCE_ERROR
location: /deployments/quick-deployment/resources/my-topic-to-avro
message: '{"ResourceType":"project_id/dataflow:dataflow.projects.locations.templates.launch","ResourceErrorCode":"401","ResourceErrorMessage":{"code":401,"message":"Request
is missing required authentication credential. Expected OAuth 2 access token,
login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.","status":"UNAUTHENTICATED","statusMessage":"Unauthorized","requestPath":"https://dataflow.googleapis.com/v1b3/projects/project_id/locations/europe-west1/templates:launch","httpMethod":"POST"}}'我可以让我的令牌运行命令: gcloud auth print-access- token,但是我不知道在哪里插入我的值和yaml的模式来插入所有值来创建数据流。
感谢您的帮助。
发布于 2020-09-03 01:12:04
"401 - Request is missing required authentication credential“错误消息是由于缺少凭据而在对Dataflow API执行POST请求时触发的。以下public reference将详细介绍如何使用Google2.0访问OAuth API。请仔细阅读,并确保按照上述步骤操作,以避免任何错误。
另一个检查的地方是仔细检查Dataflow API是否已启用,并尝试将"GOOGLE_APPLICATION_CREDENTIALS“设置为指向您正在使用的service account的JSON。
我找到了这个Authentication文档,其中提到你可以使用Authorization来提供来自项目服务帐户的访问令牌,你也可以尝试使用这种方法,但重要的是要澄清这是GKE集群的一个示例。
我注意到这个问题在这个post中得到了解决。
https://stackoverflow.com/questions/63692698
复制相似问题