-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Callable function not working in emulator (CORS issue + HttpsErrorImpl error) #3519
Comments
@binajmen since the launch of the Emulator Suite we had a bug where we ignored function regions in emulation. We fixed that in a recent release, but this means that some scripts (like yours) which depended on the bug broke. Try this: if (process.env.NODE_ENV === "development") {
firebase.firestore().useEmulator('localhost', 8080)
firebase.app().functions('europe-west1').useEmulator('localhost', 5001) // <-- added region
}
const functions = firebase.app().functions('europe-west1'); // <-- Removed the `dev` ? check The |
Hi @samtstern, Thank you for this quick reply. I'm having the following error: firebase.functions('europe-west1').useEmulator('localhost', 5001) I did a EDIT: just noticed you changed to |
@samtstern Thank you !!! To be honest I've seen so many solutions out there (here and on SO) that I was a bit lost. Hope this thread will help someone else. Cheers ! |
Environment info
firebase-tools: 9.13.1
Platform: macOS
Test case
I'm setting up my firebase client as below, specifying
useEmulator
when in development:I have multiple cloud functions, including callables (which cause me problems):
I call this function in the client as below:
Steps to reproduce
This is a Next.js project that is private (not mine, can't share or give access to repo to reproduce)
Expected behavior
To work as it was working previously
Actual behavior
What was working previously is not anymore.
I have in the network tab of Chrome a
CORS
error. The cURL equivalent of what is happening behind the scene (taken from the network tab as well) is:You'll notice it is using
us-central1
instead ofeurope-west1
. But this was working before, so it could be but shouldn't be the reason. Or is it?This is (logically?) followed by a 404:
The promise is rejected and I have the following error:
What is very strange is that it call
http://localhost:5001/project_name/us-central1/createOfflineOrder
with us-central1 whereas it should use europe-west1, but I supposed it doesn't matter when using the emulator + this setting was working properly in my last release (2-3 weeks ago).Any help would be greatly appreciated as I really can't understand what is happening here..
The text was updated successfully, but these errors were encountered: