Repository navigation
Description
Related issues
- None I could find.
[REQUIRED] Version info
node:
- Node v19.5.0
firebase-functions:
- firebase-functions 4.4.1
firebase-tools:
- firebase-tools: 12.4.4
firebase-admin:
- 11.10.1
[REQUIRED] Test case
Cloud Function
exports.updateChatroomEpoch = onCall(async (request) => {
return 'hello';
});Client Side
import { cloudFunc } from '$lib/firebase/firebaseConfig';
import { httpsCallable } from 'firebase/functions';
httpsCallable(cloudFunc, myFuncName).then((res) => {
console.log('ya')
})[REQUIRED] Steps to reproduce
- Use
firebase deploy --only functionsto deploy the Cloud Function.
[REQUIRED] Expected behavior
According to https://cloud.google.com/functions/docs/calling/http#url, Cloud Function 2nd Gen should generate 2 Function URL:
https://REGION-PROJECT_ID.cloudfunctions.net/FUNCTION_NAMEhttps://FUNCTION_NAME-RANDOM_HASH-REGION.a.run.app
The cloudfunctions.net one has a deterministic format, while the latter one does not (including random hash).
[REQUIRED] Actual behavior
Some of my functions only generate the a.run.app one, not the cloudfunctions.net one.
In GCP Cloud Function Console, click on the cloudfunctions.net endpoint (the red arrows), it shows "Page not found".
However, if I navigate to GCP Cloud Run Console(the green arrows), it did successfully created an a.run.app endpoint(the orange arrow).
The cloudfunctions.net endpoint was somehow not created. This makes the httpsCallable from the client side always fail (the client would receive a CORS Error), because the httpsCallable is trying to access a url that does not exist.
Other information
This seems to happen randomly. I have deployed 68 functions at the same time, but only 2 of them have this problem.
The solution is to delete the specific functions and deploy them again. And hope that they will create the endpoint this time. (At least it worked for me).
You HAVE TO delete the function, not just redeploy. Redeploy does not solve this problem.
I think this need to be investigated because it is clear that something went wrong when "deploying", but there are no errors from the firebase-tools. All the developer can see is the CORS Error in the browser, which can mean anything from incorrect region to not having permissions. But all they really need to do in this case is to delete the functions and deploy them again.
Were you able to successfully deploy your functions?
There were not error messages running firebase deploy.
Activity
google-oss-bot commentedon Jul 18, 2023
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Berlioz commentedon Jul 20, 2023
So I'm really sorry to say this given that you've put a lot of work into this Github issue, but I think you'd have a lot more luck with Firebase Support (https://firebase.google.com/support/troubleshooter/contact) --this seriously looks like an issue with the integration with Google Cloud Functions. Debugging this is likely going to involve looking at deploy-specific logs and that means identifying your cloud project and peeking at its contents. We can't do that off of a Github issue, but we can with a contact made through support.
JJ11teen commentedon Jul 23, 2023
I am experiencing the same issue.
I understand that a support ticket is better for specific cases, but thought it was worth capturing that this is happening to multiple users here as well.
JJ11teen commentedon Jul 23, 2023
Also massive thanks to @akb5566 for the write up and workaround! (:
LogansUA commentedon Oct 5, 2023
Yep, so same thing for me. Deleting and re-deploy function through GCP Console ->
Cloud Functionsworked, thank you @akb5566Also, this thread might answer some of the questions regarding functions URL
thandal commentedon Sep 19, 2024
Same thing happened to me today.
[edited]
... had to delete/deploy three times. Finally, the firebase console still showed the cryptic URL, but the Cloud Run function dashboard showed the cloudfunctions.net one, and requests started working with that one.
dfrancisc commentedon May 26, 2025
Not really sure if this helps somebody but after spending two days on this I found out that:
This is the only way I got it working