Fez Vrasta
Fez Vrasta

Reputation: 14835

PERMISSION_DENIED: The principal (user or service account) lacks IAM permission "cloudtasks.tasks.create"

I'm trying to schedule a task from a node.js service running on GKE Autopilot. I'm scheduling it with the @google-cloud/tasks npm package.

I am getting this error:

Error: 7 PERMISSION_DENIED: The principal (user or service account) lacks IAM permission "cloudtasks.tasks.create" for the resource "projects/my-project/locations/us-central1/queues/my-queue" (or the resource may not exist).
    at callErrorFromStatus (/app/node_modules/@grpc/grpc-js/src/call.ts:82:17)
    at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/src/client.ts:360:55)
    at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/src/client-interceptors.ts:458:34)
    at Object.onReceiveStatus (/app/node_modules/@grpc/grpc-js/src/client-interceptors.ts:419:48)
    at /app/node_modules/@grpc/grpc-js/src/resolving-call.ts:163:24
    at processTicksAndRejections (node:internal/process/task_queues:77:11)

I have made sure the service account associated to my cluster has access to the cloud tasks admin role. I don't understand if for some reason @google-cloud/tasks is not using the correct account or if I'm doing something else wrong.

enter image description here

When I use the "ghcr.io/aertje/cloud-tasks-emulator emulator and with it everything works.

Edit: I added the cloud tasks admin role to every account and it still fails...

Upvotes: 0

Views: 64

Answers (0)

Related Questions