Next.js Discord

Discord Forum

Help: MongoDB NextAuth Credentials setup

Unanswered
Giant Angora posted this in #help-forum
Open in Discord
Giant AngoraOP
I had done the [Nextjs Dashboard tutorial](https://nextjs.org/learn/dashboard-app) from the docs so I thought i could make similar setup with MongoDB. I'm using NextJs 14, MongoDB and NextAuth 5 (beta) with the Credentials provider (username-password)

The /login page is giving build error after multiple attempts of mine to fix it

Earlier it was saying:
./node_modules/.pnpm/mongodb@6.8.0/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js:34:25
Module not found: Can't resolve 'child_process'

Now it says:
 ⨯ ./node_modules/.pnpm/@mapbox+node-pre-gyp@1.0.11/node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
| <html>
| <head>

[Code repo link](https://github.com/datkumar/vocab-site)

I want to keep most of the site content accessible without auth and only the edit functionality requiring auth at /admin* route for admin panel

2 Replies

Giant AngoraOP
Should I downgrade to a certain stable version?
Giant AngoraOP
My bad guys. There's "use server", "use client" and import "server-only". No such thing as use "server-only"