Skip to content

UNAUTHENTICATED Error #1015

Closed
Closed

Description

@chunyongg

[REQUIRED] Version info

node:

14.18.0

firebase-functions:

3.14.1

firebase-tools:

8.20.0

firebase-admin:

9.19.0

[REQUIRED] Test case

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

Activity

  1. google-oss-bot commented on Dec 20, 2021

    @google-oss-bot
    Collaborator

    I found a few problems with this issue:

    • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
    • This issue does not seem to follow the issue template. Make sure you provide all the required information.
  2. taeold commented on Dec 22, 2021

    @taeold
    Contributor

    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 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).

  3. added
    needs-author-feedback
    and removed on Dec 22, 2021
  4. chunyongg commented on Dec 23, 2021

    @chunyongg
    Author

    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)

  5. added and removed
    needs-author-feedback
    on Dec 23, 2021
  6. taeold commented on Dec 23, 2021

    @taeold
    Contributor

    Hi @taeold,

    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.

  7. added
    needs-author-feedback
    and removed on Jan 11, 2022
  8. google-oss-bot commented on Jan 12, 2022

    @google-oss-bot
    Collaborator

    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!

  9. google-oss-bot commented on Jan 17, 2022

    @google-oss-bot
    Collaborator

    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.

  10. dsl101 commented on Mar 18, 2022

    @dsl101

    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.

  11. taeold commented on Mar 18, 2022

    @taeold
    Contributor

    @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.

  12. alexghi commented on Apr 7, 2023

    @alexghi

    any updates on this? i still get the error

  13. MuratTenet commented on Aug 1, 2023

    @MuratTenet

    The issue persists. What is the solution?

  14. ChurikiTenna commented on Oct 12, 2023

    @ChurikiTenna

    I still get the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions