Search code examples
google-cloud-functionshttp-status-code-403google-iam

Cloud Function with Cloud Function Invoker rights gets 403 status


I have two Cloud Functions: a frontend and an API. I have added a frontend service account to the frontend Cloud Function that has Cloud Function Invoker rights:

enter image description here

I have also explicitly added this service account as a permission to the API Cloud Function, yet I am still getting 403 Not Authorized statuses.

enter image description here

 const categories = await this.$axios.$get("/api/v1/categories/", {
    params: { hasParent: 0 },
  });

Solution

  • You must add the authorization header to make it work! It's not out of the box!

    But, the cloud functions doc is bad to explain that. Use the Cloud Run documentation instead (the 2 services use the same underlying infrastructure and the principle are the same, the doc is simply easier to use on Cloud Run!!)