[SOLVED] Uncaught (in promise) Error: Web3Api in console

i have this message in the console but the link shown in a previous forum has expired.

Uncaught (in promise) Error: Web3Api not initialized, run Moralis.start() first
at Function. (moralis.js:7402)
at tryCatch (moralis.js:41120)
at Generator.invoke [as _invoke] (moralis.js:41351)
at Generator.next (moralis.js:41176)
at asyncGeneratorStep (moralis.js:28195)
at _next (moralis.js:28217)
at moralis.js:28224
at new Promise ()
at new Wrapper (moralis.js:32713)
at Function. (moralis.js:28213)

Moralis.initialize("cYotdh4c5DM14zRj5K7DNTrWUf70yLQVQZNRbhUz");
Moralis.serverURL = "https://oczwxd7kjzwb.usemoralis.com:2053/server";

async function intitializeApp() {
	let currentUser = Moralis.User.current();
	if (!currentUser) {
		currentUser = await Moralis.Web3.authenticate();
	}
	//alert("user signed in");

	const options = {
		address: "0x25bb1a10c391425744e44d2399223b7712852a21",
		chain: "rinkeby",
	};
	const NFTs = await Moralis.Web3API.token.getAllTokenIds(options);
	console.log(NFTs);
}
intitializeApp();

there is a new syntax now with Moralis.start instead of those two lines:

https://docs.moralis.io/moralis-server/getting-started/connect-the-sdk#authentication-demo

1 Like

thank you, all sorted