Search code examples
firebase-authenticationfirebase-tools

Firebase Emulator Seems To Be Trying To Run TypeScript Code As JavaScript Code In Sign In With Google PopUp In Remix


I am building a sign in page with firebase auth. I have made a simple button that you can click to login or signup with Google. It works fine when using it without the firebase emulator, but when I use the firebase emulator I don't see any of the accounts I have made in the emulator UI and nothing happens when I click the button to make the account in the UI when I click the button. I opened dev tools on the popup and I see this error:

Uncaught SyntaxError: Unexpected token ':'.

I went to the sources panel and saw that it was a error on the error part of a try catch block. This is the line of code that has the error: } catch (e: any) {. It seems to be trying to run TypeScript code as JavaScript code. Any idea why and how to fix it?


Solution

  • This has been bothering me for days. A quick fix I found was to install a previous version of firebase tools:

    npm install -g firebase-tools@9.23.0
    

    Then run firebase init again, but only to re-download the emulators.

    You should see the following to indicate success:

    ...
    i  database: downloading firebase-database-emulator-v4.7.2.jar...
    ...
    i  database: Removing outdated emulator files: firebase-database-emulator-v4.7.3.jar
    ...