DEV Community

Discussion on: Permission error when generating a custom token on Cloud Functions

Collapse
 
dominicks profile image
dominic-ks • Edited

Thanks for posting this, helped me narrow down the issue much more quickly.

Interestingly this issue is actually referred to in the docs:

In the docs, they suggest that it's the

  • {project-name}@appspot.gserviceaccount.com

user that needs updating, though like others, my project seems to be using an unexpected user as mine uses

  • {project-id}@cloudbuild.gserviceaccount.com

and I do mean {project-id} and not {project-name} !!

No idea why it is using this one or if this is configurable somewhere, but for anyone else landing here, if adding the permission to a user that makes sense doesn't work, it's worth going through testing the various service accounts one at a time to find the one that works.

There perhaps is a more clever way of determining the user, perhaps outputting it to the logs somehow. But there we are.