[SOLVED] Web3auth_database_main # Unhandled Runtime Error

Hello :slight_smile:

I followed along the YouTube video: Connect to a Database with Web3 Authentication | MongoDB, NextJS and Moralis https://www.youtube.com/watch?v=rMijvDtNYlQ
I then downloaded full repo and installed per instructions and made the necessary mongoDB - updated .env.local with everything and ofcause installed but Iโ€™m getting this error:

Unhandled Runtime Error

TypeError: Cannot read properties of null (reading โ€˜authโ€™)

Call Stack
formatUrl

node_modules\next\dist\shared\lib\router\utils\format-url.js (12:10)

Object.formatWithValidation

node_modules\next\dist\shared\lib\router\utils\format-url.js (69:11)

resolveHref

node_modules\next\dist\shared\lib\router\router.js (108:72)

prepareUrlAs

node_modules\next\dist\shared\lib\router\router.js (165:37)

Router.push

node_modules\next\dist\shared\lib\router\router.js (384:25)

instance.

node_modules\next\dist\client\router.js (143:19)

_callee$

webpack-internal:///./pages/signin.jsx (84:13)

tryCatch

node_modules\next\dist\compiled\regenerator-runtime\runtime.js (45:15)

Generator.invoke [as _invoke]

node_modules\next\dist\compiled\regenerator-runtime\runtime.js (274:0)

prototype. [as next]

node_modules\next\dist\compiled\regenerator-runtime\runtime.js (97:0)

asyncGeneratorStep

node_modules@swc\helpers\src_async_to_generator.mjs (3:0)

_next

node_modules@swc\helpers\src_async_to_generator.mjs (25:0)

<<<<<<< I tried the documentation link but it returns a 404 :frowning:

Can anyone help? <3

What is the documentation link that you tried?

This error should mean that a variable is null where variable.auth is used

Moralis NextJS Auth Demo App

Documentation available at https://docs.moralis.io/docs/nextjs-web3-auth

Link to repo:

Try this one:

Seems the error is related to mongoDB . . . Failed handshake

What error about mongo db?
Maybe is a url that doesnโ€™t work?

Yeah - It was the DB user, I configured wrong . . . It works :slight_smile:

Thanx and have a nice weekend <3

1 Like