Has anyone got the react-moralis package to work with Next.js?
I am trying to do simple authentication and the metamask login does work as expected but after signing you get following response into the console:
RESTController.js:304 POST http://localhost:3000/undefined/users 404 (Not Found)
and the isAuthenticated will not be set correctly.
import React from "react";
import { MoralisProvider } from "react-moralis";
function MyApp({ Component, pageProps }) {
return (
<MoralisProvider
appId={String(process.env.MORALIS_APP_ID)}
serverUrl={String(process.env.MORALIS_SERVER_URL)}
>
<Component {...pageProps} />
</MoralisProvider>
);
}
export default MyApp;
import { useMoralis } from "react-moralis";
export default function Login() {
const { authenticate, isAuthenticated } = useMoralis();
return (
<>
<button onClick={() => authenticate()}>Login here</button>
</>
);
}
Not sure if Next.js requires some additional configuration or what could possibly be the solution for this?