0
votes

Recently I added a couple of new callable firebase cloud functions to my mobile app. The thins is, once I deployed and tested my functions I was not able to invoke them failing with an UNAUTHENTICATED error. I re-deployed all my functions and still, the old ones can be invoked while the new one failed with UNAUTHENTICATED. I did some research and people were talking about the version of the Node. I upgraded the Node version but it did not work out. I upgraded the firebase-functions version and the firebase-admin version. No luck.

I tried to browse to the URL of one of the older callable cloud functions that I have deployed before and it was ok. Then I tried to browse to a newly deployed https callable firebase cloud function. I saw this message in my browser:

Your client does not have permission to get URL /function_name from this server.

Any ideas what is going on here?

Thanks

2

2 Answers

2
votes

Ok, here is what I found.

According to this page: https://cloud.google.com/functions/docs/securing/managing-access-iam#allowing_unauthenticated_function_invocation

As of January 15, 2020, HTTP functions require authentication by default. You can specify whether a function allows unauthenticated invocation at or after deployment.

Here is what you do:

1- Browse to the link above

2- Find "Viewing users" section and click on the "Go to Google Cloud Console" button.

enter image description here

3- On the screen that opens, you will see a list of your deployed cloud functions. Select the one that is throwing the UNAUTHENTICATED error.

Click the Add Member button that appears on the right pane.

enter image description here

4- Select Cloud Functions Invoker role

enter image description here

5- Type allusers inside the "New Members" box. Select allUsers or allAuthenticatedUsers (Try with both to see which one works for you)

enter image description here

6- Hit "Save"

You should be able to invoke your firebase https callable cloud function now, and the UNAUTHENTICATED error should be gone.

0
votes

in my case, I write wrong function name in my Flutter app

final callable = _functions.httpsCallable('wrong function name in here');