[SOLVED] MoralisError [Moralis SDK Error]: [C0009] Modules are started already. This method should be called only once on Next JS

Im trying to create my next js 13 route to fetch the nfts,

const Moralis = require("moralis").default;

const { EvmChain } = require("@moralisweb3/common-evm-utils");

Moralis.start({

apiKey: process.env.MORALIS,

});

let fetchingNFTs = false;

const runApp = async (address, owner) => {

const chain = EvmChain.POLYGON;

let ownedNFTs; ...

Keep running into this error, im using next js 13, typescript.

Hey @Arcus,

I see that this is marked as solved.

For others, just need to wrap Moralis.start with this:

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