Firebase Hosting with Cloud Run

273 views
Skip to first unread message

Imr

unread,
May 15, 2024, 4:55:06 PM5/15/24
to Firebase Google Group
Hello! I'm trying to set up Firestore Hosting with a Cloud Run service with a custom domain.
 
The rewrites work nicely, and I reach the service through my custom domain. 

My issue is with authentication - when I select Require Authentication on my cloud run instance, I am (obviously) getting a 403 error when trying to reach it via the custom Firebase Hosting URL.

I tried setting an IAM principal of "Cloud Run Invoker" on all Firebase service accounts, but it didn't fix the issue.

How can I authenticate with a Cloud Run instance, when using Firebase Hosting to create a custom DNS for it? Is it even possible without adding extra code/an extra cloud function?

Thank you

phuzzy

unread,
May 23, 2024, 12:33:44 PM5/23/24
to Firebase Google Group
Hello! I thought I was running into the same problem and tried to work around it by adding an "audience" to the service:

gcloud run services update my-service --region=us-central1 --add-custom-audiences=https://my.custom.domain/my-service-url

When you look at the security tab on the service you'll now see the custom audience field filled. This did not help me (but might work for you)...

It turns out that with Require Authentication on, neither the default Firebase url nor the Cloud Run generated url work for me. Were you able to get this working?

Best, p

Reply all
Reply to author
Forward
0 new messages