NextJs | window is not defined and Moralis start Error

I am using Moralis with NextJs cloud Function (Node environment) but when this function is running
I got two errors Moralis.start warning: to use web3 access, moralisSecret is required and window is not defined.

So is there someone that knows how can I fix this because my purpose is to connect to metamask thanks

I don’t know where from are all those errors, you could put an await before Moralis.start

what you run here is server side?

1 Like

Yes exactly I am running a nextJs application where I have my serverless function based with NodeJs environment

if that is running server side, I don’t think that you can make that authentication with MetaMask work that way, as metamask would be on client/browser side

you should be able to make a Web3API call there with Moralis.Web3API.token for example