Request failed with status code 500'

I was cloned the code here https://github.com/IAmJaysWay/web3auth_database by moralis to connect my website to MongoDB and I got this error. POST http://localhost:3000/api/auth/request-message 500 (Internal Server Error).

I tried looking for solutions but I couldn’t find one. I need help on how to solve this error.

Annotation 2022-12-22 103526

Hi @theonrex, this repository seem to be using old version of moralis sdk. Can you try again after updating the sdk.

And if you still get the same error after updating, then try adding this console log in pages/api/auth/request-message.js page before the requestMessage function, to debug more on what is causing the error.

console.log({
            address,
            chain,
            network,
            ...config,
        })