You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Function is deployed with firebase deploy --only functions (it is a https.onCall function)
[REQUIRED] Steps to reproduce
Deployed function is called from a web app
[REQUIRED] Expected behavior
Function is called successfully
[REQUIRED] Actual behavior
UNAUTHENTICATED error
Were you able to successfully deploy your functions?
Yes
I understand I can head in to Google Cloud console and add the permission for allUsers, but do I have to do that for every deployed function? Additionally, it seems to be happening only ocassionally
All Cloud Functions by default will not allow unauthenticated invocation of HTTP function
When you deploy your functions w/ the firebase cli, it will try to change the invoke permissions to include allUsers so you don't have to. Note changing the permission is highly privileged operation, and whatever user/service account being used to deploy the function may not have the permission to do so. Check out your logs to see if you see any warning message about the permission failure (firebase deploy will NOT fail if it just fails to change the invocation permission).
Which service account do I have to give the permissions for, and which permission do I give it?
Whatever service account you are using to run firebase deploy. I suspect you are using some CI/CD to do the deployment - if you are deploying from your computer, then just make sure your account (or whatever account was used for firebase login has permission to modify iam policy. Given that you are able to make the change using the GCP console, I suspect that you do have it.
The logs are deleted after a deploy, so how can I check the logs ? (I assume you are referring to firebase-debug.log)
@chunyongg If the deployment had any issue, you will see firebase-debug.log. You can force one to write on by passing the --debug flag on your command, e.g. firebase deploy --debug.
Hey @chunyongg. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
I'm also having this issue Using firebase CLI 10.3.1 and on deploying a new function, it is always deployed in a way that causes it to return 403 when triggered using the firebase SDK firebaseFunctions().httpsCallable(). My fix so far has been to edit it in the console to 'Allow Unauthenticated', but it would like to avoid that if it's supposed to work differently.
I'm running firebase deploy locally, logged in as the account owner, so I doubt it is a permissions issue. The debug log has these lines early on:
[debug] [2022-03-18T10:20:59.704Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2022-03-18T10:20:59.705Z] > authorizing via signed-in user ([REMOVED])
[debug] [2022-03-18T10:20:59.705Z] [iam] checking project [REMOVED] for permissions ["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","datastore.indexes.create","datastore.indexes.delete","datastore.indexes.list","datastore.indexes.update","firebase.projects.get","firebaserules.releases.create","firebaserules.releases.update","firebaserules.rulesets.create"]
[debug] [2022-03-18T10:20:59.708Z] >>> [apiv2][query] POST https://cloudresourcemanager.googleapis.com/v1/projects/[REMOVED]:testIamPermissions [none]
[debug] [2022-03-18T10:20:59.708Z] >>> [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/[REMOVED]:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","datastore.indexes.create","datastore.indexes.delete","datastore.indexes.list","datastore.indexes.update","firebase.projects.get","firebaserules.releases.create","firebaserules.releases.update","firebaserules.rulesets.create"]}
[debug] [2022-03-18T10:21:00.373Z] <<< [apiv2][status] POST https://cloudresourcemanager.googleapis.com/v1/projects/[REMOVED]:testIamPermissions 200
[debug] [2022-03-18T10:21:00.374Z] <<< [apiv2][body] POST https://cloudresourcemanager.googleapis.com/v1/projects/[REMOVED]:testIamPermissions {"permissions":["cloudfunctions.functions.create","cloudfunctions.functions.delete","cloudfunctions.functions.get","cloudfunctions.functions.list","cloudfunctions.functions.update","cloudfunctions.operations.get","datastore.indexes.create","datastore.indexes.delete","datastore.indexes.list","datastore.indexes.update","firebase.projects.get","firebaserules.releases.create","firebaserules.releases.update","firebaserules.rulesets.create"]}
[debug] [2022-03-18T10:21:00.375Z] >>> [apiv2][query] POST https://iam.googleapis.com/v1/projects/[REMOVED]/serviceAccounts/[REMOVED]@appspot.gserviceaccount.com:testIamPermissions [none]
[debug] [2022-03-18T10:21:00.375Z] >>> [apiv2][body] POST https://iam.googleapis.com/v1/projects/[REMOVED]/serviceAccounts/[REMOVED]@appspot.gserviceaccount.com:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
[debug] [2022-03-18T10:21:00.591Z] <<< [apiv2][status] POST https://iam.googleapis.com/v1/projects/[REMOVED]/serviceAccounts/[REMOVED]@appspot.gserviceaccount.com:testIamPermissions 200
[debug] [2022-03-18T10:21:00.591Z] <<< [apiv2][body] POST https://iam.googleapis.com/v1/projects/[REMOVED]/serviceAccounts/[REMOVED]@appspot.gserviceaccount.com:testIamPermissions {"permissions":["iam.serviceAccounts.actAs"]}
What should I be looking for in the (copious) logs that show the allUsers permission being granted or at least attempted? I can't find that string anywhere, so assume it's not a literal.
Activity
google-oss-bot commentedon Dec 20, 2021
I found a few problems with this issue:
taeold commentedon Dec 22, 2021
Hi @chunyongg.
All Cloud Functions by default will not allow unauthenticated invocation of HTTP function
When you deploy your functions w/ the firebase cli, it will try to change the invoke permissions to include
allUsersso you don't have to. Note changing the permission is highly privileged operation, and whatever user/service account being used to deploy the function may not have the permission to do so. Check out your logs to see if you see any warning message about the permission failure (firebase deploy will NOT fail if it just fails to change the invocation permission).chunyongg commentedon Dec 23, 2021
Hi @taeold,
Which service account do I have to give the permissions for, and which permission do I give it?
The logs are deleted after a deploy, so how can I check the logs ? (I assume you are referring to
firebase-debug.log)taeold commentedon Dec 23, 2021
Whatever service account you are using to run
firebase deploy. I suspect you are using some CI/CD to do the deployment - if you are deploying from your computer, then just make sure your account (or whatever account was used forfirebase loginhas permission to modify iam policy. Given that you are able to make the change using the GCP console, I suspect that you do have it.@chunyongg If the deployment had any issue, you will see
firebase-debug.log. You can force one to write on by passing the--debugflag on your command, e.g.firebase deploy --debug.google-oss-bot commentedon Jan 12, 2022
Hey @chunyongg. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
google-oss-bot commentedon Jan 17, 2022
Since there haven't been any recent updates here, I am going to close this issue.
@chunyongg if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.
dsl101 commentedon Mar 18, 2022
I'm also having this issue Using firebase CLI 10.3.1 and on deploying a new function, it is always deployed in a way that causes it to return 403 when triggered using the firebase SDK
firebaseFunctions().httpsCallable(). My fix so far has been to edit it in the console to 'Allow Unauthenticated', but it would like to avoid that if it's supposed to work differently.I'm running firebase deploy locally, logged in as the account owner, so I doubt it is a permissions issue. The debug log has these lines early on:
What should I be looking for in the (copious) logs that show the
allUserspermission being granted or at least attempted? I can't find that string anywhere, so assume it's not a literal.taeold commentedon Mar 18, 2022
@dsl101 I suspect this might a bug with the new version of the CLI. I'm creating a new issue and investigating - thanks for the report.
alexghi commentedon Apr 7, 2023
any updates on this? i still get the error
MuratTenet commentedon Aug 1, 2023
The issue persists. What is the solution?
ChurikiTenna commentedon Oct 12, 2023
I still get the same error.