SignInWithMoralis() for firebase gives "Unexpected token 'export' "

Although I had the SignInWithMoralis() working with the firebase extension in next.js, I needed to reproduce a small working version and now I keep running into a new error that I cannot seem to solve. getMoralisAuth() returns an object, but when I run SignInWithMoralis I get this error:

SyntaxError: Unexpected token ‘export’
at […]\node_modules\ (moralisweb3\client-firebase-auth-utils\lib\index.js:1)

This is my code

import { getAuth } from 'firebase/auth';
import { getFunctions } from 'firebase/functions';
// import { getMoralisAuth } from '@moralisweb3/client-firebase-auth';
import { getMoralisAuth } from '@moralisweb3/client-firebase-auth-utils';
import { signInWithMoralis } from '@moralisweb3/client-firebase-evm-auth';
const firebaseConfig = {....
const app = initializeApp(firebaseConfig);
const auth = getAuth(app);
const functions = getFunctions(app);
const moralisAuth = getMoralisAuth(app, {
  auth,
  functions,
});
console.log(moralisAuth);

async function signIn() {
await signInWithMoralis(moralisAuth);
}

Can you see what is wrong?

1 Like

Issue seems to be with the latest version of @moralisweb3/client-firebase-auth, which was upgraded 3 days ago from 2.14.3 to to 2.16.1.

When downgrading to 2.14.3 I get no errors, although the signInWithMoralis() is still not working as intended. Now, the ext-moralis-auth-requestMessage function is invoked on cloud function, but the issueToken function is never invoked and no user is created in firebase.

I am not sure if this is a related error or a new one?

1 Like

Hi @Va55

Are you seeing any other errors in the browser console or under network tab?

Getting the same error with @moralisweb3/next 2.16.1

No error, the function is just never invoked. I ended up having to circumvent the use of SignInWithMoralis() completely and sign into firebase with a custom token.

@Va55 @bzrov please update your packages to the latest version, the issue should be fixed

npm add @moralisweb3/client-firebase-evm-auth@latest
npm add @moralisweb3/next@latest

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.