firebase-tools-ui icon indicating copy to clipboard operation
firebase-tools-ui copied to clipboard

TypeError: Cannot read property 'createUserWithEmailAndPassword' of undefined at data

Open ghost opened this issue 3 years ago • 5 comments

I am trying to use firebase emulators: I can see my application at 5000 and auth at 9099 localhosts but the auth emulator is not receiving my data as firebase auth.

I have used this command - "firebase --project="" emulators:start" to start the emulators.

Within the browser logs, I can see a post request is being generated to a URL that contains my API key. When tried to access the API URL manually it gives the below output :

{ "error": { "code": 404, "message": "Not Found", "errors": [ { "message": "Not Found", "reason": "notFound" } ], "status": "NOT_FOUND" } }

ghost avatar Jan 06 '21 11:01 ghost

The Auth emulator requires a non-empty project ID to work properly. May I ask the reason behind --project ""?

yuchenshi avatar Jan 06 '21 16:01 yuchenshi

@yuchenshi thank you for the quick reply. Within my comment i have kept it empty however while actual use i have added the name of my project id within the command. Also the command runs successfully. My application gets hosted on local emulators at port 5000. I can see my auth emulator as well but my data doesn't get transferred to auth emulator

ghost avatar Jan 06 '21 16:01 ghost

To try to troubleshoot the 404 here are there steps you've found or a minimal project we could reproduce this issue with? Alternatively code for repro can be shared privately via our support channels here https://firebase.google.com/support/troubleshooter/contact

strom2357 avatar Jan 09 '21 00:01 strom2357

@strom2357 I have hosted my project using this command - firebase --project="{myproject}" emulators:start

Within my HTML File if I use the below code

"await firebase.auth().createUserWithEmailAndPassword("[email protected]", "password");" --> In this case it works fine and my email id and password go to firebase cloud auth. Now the issue is I want to use auth emulators and I am using the below within my code :

"await firebase.auth().useEmulator('http://localhost:9099').createUserWithEmailAndPassword("[email protected]", "password");" --> This doesn't send my values to the auth emulators.

My hosting emulators are working good and the application is hosted on port 5000 using hosting emulators. While I see my web page at port 5000, It says "Running in emulator mode. Do not use with production credentials." but my auth emulators don't take up these values.

Kindly help!

ghost avatar Jan 15 '21 10:01 ghost

Hi there! useEmulator does not return anything -- it side effects. Have you tried something like this?

firebase.auth().useEmulator('http://localhost:9099');
await firebase.auth().createUserWithEmailAndPassword("[email protected]", "password");

yuchenshi avatar Jan 19 '21 17:01 yuchenshi