[SOLVED] Service Functions not available, firebase, auth api

Hey guys setting up my first moralis app with firebase and i’ve followed all steps in the moralisweb3 yt video: https://www.youtube.com/watch?v=2HLxYYmZp94&list=PLFPZ8ai7J-iTSo8lnHNpMulFjF3tYW2aB&index=3 except added my own frontend.

Getting the following error loading up my app: Screenshot 2023-03-03 at 10.37.53

FE Code for auth init looks like:

const app = initializeApp(firebaseConfig);
const moralisAuth = getMoralisAuth(app);
const auth = getAuth(app);

looks like the getMoralisAuth is failing.

Can’t find anything about this online either, some help would be greatly appreciated! Thanks

Hi @wesleyvans

We might need more details to reproduce the error or to know what might have caused the error.

Based on the error message it seems something related to the extension not being set up properly.
You can verify the steps from the youtube tutorial to check if it was followed correctly.

The docs for the same tutorial are available here.

@johnversus The moralis auth does seem to show up in the extensions tab in firebase and these 2 show up in my functions, so those seem to be in there correctly if im not mistaken! Screenshot 2023-03-03 at 11.24.24|282x111 Do these functions seem to be correct?

@johnversus However the usage no my moralis dashboard seems to be 0, which i suppose makes sense as the implementation fails at the moralis point.

hmm, I see that you have chosen different location (europe-west1) for installing the extension. Can you once check the browser network tab for the url of request sent from app?

If the error is related to the location then you will see wrong location url in the network tab.

Ah yes this could be related. Network tab is not actually sending a request from the app. Probably errors before it actually sends a request.

Screenshot 2023-03-03 at 11.34.07

You can change the location error by using regionOrCustomDomain params

getMoralisAuth(app, {
  regionOrCustomDomain: "europe-west1"
})

But that seems not related to error here
Are you using next js? I have seen a user reporting a similar issue with the next js but it works without error on react app.

nope plain react, but it actually does seem to work with the troubleshoot of the Next.JS with the following:

const functions = getFunctions(app);

const moralisAuth = getMoralisAuth(app, {
    auth,
    functions
});

problem is now is i get the CORS errors on local, that’s another issue tho!

@johnversus Should i move that to another issue if i can’t figure that out? it’s about

Access to fetch at 'https://us-central1-ctseer-b6274.cloudfunctions.net/ext-moralis-auth-requestMessage' from origin 'http://localhost:3000' has been blocked by CORS policy:

Try using a different location by using regionOrCustomDomain params as the request url shows use-central1.

@johnversus This results in You cannot set "regionOrCustomDomain" and "functions" parameters at the same time do i have to set these seperately?

@johnversus it actually works without fetching the functions with setting the proper region now. not sure what i missed before, but it works! Thank you so much!

1 Like

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