Firebase Auth : Service functions is not available

Iā€™m getting the

Uncaught Error: Service functions is not available

I already tried 2 things.

  1. delete node_module and install again
  2. The regionOrCustomDomain option

both did not work.

I have my extensions on asia-east2.

It breaks everytime I use the getMoralisAuth(app) in the code.

This my package

// 
Import the functions you need from the SDKs you need
import { initializeApp } from "firebase/app";
import { getFirestore } from "firebase/firestore"
import { getMoralisAuth } from '@moralisweb3/client-firebase-auth-utils';
import { signInWithMoralis } from '@moralisweb3/client-firebase-evm-auth';
import { getAuth } from '@firebase/auth';

const fireapp = initializeApp(firebaseConfig);
const firestore = getFirestore(fireapp);
const auth = getAuth(fireapp);
const moralisAuth = getMoralisAuth(fireapp);
"dependencies": {
    "@moralisweb3/client-firebase-auth-utils": "^2.17.0",
    "@moralisweb3/client-firebase-evm-auth": "^2.17.0",
    "@reduxjs/toolkit": "^1.9.3",
    "@testing-library/jest-dom": "^5.16.5",
    "@testing-library/react": "^13.4.0",
    "@testing-library/user-event": "^13.5.0",
    "@types/jest": "^27.5.2",
    "@types/node": "^16.18.16",
    "@types/react": "^18.0.28",
    "@types/react-dom": "^18.0.11",
    "firebase": "^9.18.0",
    "moralis-v1": "^1.12.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-redux": "^8.0.5",
    "react-scripts": "5.0.1",
    "redux": "^4.2.1",
    "typescript": "^4.9.5",
    "uuid": "^9.0.0",
    "web-vitals": "^2.1.4"
  },

not sure if related, but I have the stream extension working first, before I decided to convert my auth from react-moralis to firebase-moralis-auth.

Just to be sure, are you on a Blaze Plan on firebase? it is required if you want to use the firebase functions.
If this is not the issue, the you can try uninstall the firebase and reinstall it, or try using a previous version like 9.17.1

hey bro, thanks for replying.

Yes Iā€™m on Blaze plan.

I havenā€™t tried going down firebase versions.

Iā€™ll try that. Anything else I should look into?

tried to do the exact code from here and use the same firebase config.

Iā€™m still getting this error, could it be with my firebase account? I canā€™t really tell from which part and what to do next as I only followed the tutorial.

is there a setting on Moralis that I need to turn on or active?

No there is not. I see this project is a React project. By any chance that you install the plugin on the frontend, because it should be only for backends.

The tutorial is a React app, I havenā€™t setup a backend setup just for auth.

I understand, but for the extension to work it needs to be installed for the backend and will not work on the frontend at the moment. So if you like to use it, youā€™ll need a separate backend, potentially use API from frontend to call your backend

Hmmm thatā€™s going to be far from the tutorial, so that video is not valid anymore?

If ever, can I set this up firebase functions?

Which video or tutorial are you referring to, let me have a check on it. But should be valid since the extension is still a working product.

Here

Ohh alright gotcha, my bad looks like it is available on the Frontend as well. In that case Iā€™m wondering if you ran

firebase deploy  --only extensions

Ok I did this twice already, but still the same.

hi wesleyvans, sorry to disturb your peace man, you were able to solve this issue. But I see you came from plain react into a new Next project, how were you able to solve this? been going through this fodayzz. I canā€™t seen to figure out why the tutorial works, and mine doesnā€™t even with same package versions.

Do you see any other errors in your browser console or in your network tab?

the console error says Service functions is not available.

no error in the network tab.

itā€™s so strange, I copied the exact code from the FirebaseAuthExtension (which works), but the copied one doesnā€™t work. I puzzled how, same package dependencies and same code have different results?

it always fail on this line

const moralisAuth = getMoralisAuth(app);

This error somehow has different solutions. I have seen another user on discord who solved it by just error handling. In his case, the thrown error broke the app but when he handled the error using try catch he was able to use the getMoralisAuth function without error.
Maybe the error was caused when the component is mounted.

You could try this approach once.

how would that look like?

I tried, but as expected it goes to catch, what to do next?

Nothing else is required. When you try to click again it should work normally. (at least for the other user it worked like this)

FWIW, I am having what sounds like the same problem. Iā€™m not on Moralis, just using the standard firebase npm in a React app, and code that was working a few days ago now fails to access Firestore. I filed a ticket with them 2 days ago, have heard nothing back. Other Firebase functionality like Auth works fine, but any attempt to fetch a Firestore collection results in an error from their library: ā€œError: Service firestore is not availableā€. I also tried another library that fetches collections (@stripe/firestore-stripe-payments) and it produces the same error.