firebase / firebase/firebase-functions

Feature request: To be able to set `custom audience` in V2 functions

Open
#1,399 1 comment 0 reactions 0 assignees View on GitHub
feature request
Dominant language
TypeScript
Stars
1.1k
Forks
232
Avg merge
20h 46m
Merged PRs (30d)
15

Description

### Related issues

Couldn't find any.

### [REQUIRED] Version info

**node:** v18.16.0

**firebase-functions:** 4.4.0

**firebase-tools:** 12.0.0

**firebase-admin:** 11.8.0

### Feature request

I am using a load balancer on top of firebase functions to direct traffics to necessary API endpoints on a single domain. However, Cloud Run's custom authentication returns 401 if I set the `aud` field in the token as my custom domain because the `custom audience` needs to be set as per the documentation here: https://cloud.google.com/run/docs/configuring/custom-audiences

Since there is no option to set custom audience in `HttpsOptions`, I have to manually run
`gcloud beta run services update --add-custom-audiences=https://custom.endpoint.com` to add custom audiences.

It would be nicer to be able to set this when we are making firebase function itself, like:
```typescript
functionsV2.https.onRequest(
{
memory: "1GiB",
ingressSettings: "ALLOW_INTERNAL_AND_GCLB",
invoker: "private",
customAudiences: ["https://custom.endpoint.com"]
},
connectApp,
)
```

It seems like it's supported on terraform (https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_run_service#annotations) in the form of `annotations` so it might be nicer to support annotations when making firebase functions V2.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.