[solved] Moralis.start query

Hi Folks,

I have a hopefully quick question, im running getWalletNFts endpoint inside a firebase function and as part of this I have the Moralis.start code in there. Is there a way to check if the Moralis client has already been started so its not called twice.

At the moment when im testing the firebase endpoint it works fine the first time, but on the second test it fails as Moralis has already started.

Thanks David.

Hey David,

Yes it is possible, you can do that by simply adding this if statement before calling your Moralis.start.

if (!Moralis.Core.isStarted) {
    await Moralis.start({ apiKey: process.env.MORALIS_API_KEY });
}

Hope this helps!

1 Like

This is perfect, thank you so much for the help

1 Like

Awesome!

I’ll be closing this thread for now, but if you have any other issues feel free to open a new one :grinning_face_with_smiling_eyes:

We’ll be available 24/7 to help you out.

1 Like