"Fetching user failed: NetworkError when attempting to fetch resource."

default discord avatar
christianjmay
3 weeks ago

Hi. I'm attempting to replace a database in an app I'm building with Payload. I'm using the next-payload package.



When I first navigate to /admin to access the payload backend, I get this message in the browser, then my Next app crashes with no error message. Any thoughts on what could be the cause?



This is my payload config:



import { buildConfig } from 'payload/config'
import { mongooseAdapter } from '@payloadcms/db-mongodb'

import { webpackBundler } from '@payloadcms/bundler-webpack'

import { lexicalEditor } from '@payloadcms/richtext-lexical' // beta

export default buildConfig({
  admin: {
    bundler: webpackBundler(), // or viteBundler()
    autoLogin: {
      email: 'christianmay21@gmail.com',
      password: 'test',
      prefillOnly: true
    }
  },
  db: mongooseAdapter({
    url: process.env.DATABASE_URI ?? "",
  }), // or postgresAdapter({}),
  editor: lexicalEditor({}), // or slateEditor({})
  collections: [
    {
      slug: 'pages',
      fields: [
        {
          name: 'title',
          type: 'text',
          required: true,
        },
        {
          name: 'content',
          type: 'richText',
          required: true,
        },
      ],
    },
  ],
  globals: [
    {
      slug: 'header',
      fields: [
        {
          name: 'nav',
          type: 'array',
          fields: [
            {
              name: 'page',
              type: 'relationship',
              relationTo: 'pages',
            },
          ],
        },
      ],
    },
  ],
})


My primary issue here was that I did not have MongoDB installed 🙂

    Open the post
    Continue the discussion in Discord
    Like what we're doing?
    Star us on GitHub!

    Star

    Connect with the Payload Community on Discord

    Discord

    online

    Can't find what you're looking for?

    Get help straight from the Payload team with an Enterprise License.