Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

The Admin panel and none of the pages created through the CMS are not being rendered in prod

default discord avatar
juansebastianmendoza2 years ago
5

I have a NextJS + Payload CMS app being deployed on Vercel. It is based on this starter template:

https://github.com/payloadcms/nextjs-custom-server

.



I'm not sure if this issue is because of the environment variables, but I have the same as the one in my local (

http://localhost:3000

is the value of

PAYLOAD_PUBLIC_SERVER_URL

and

NEXT_PUBLIC_SERVER_URL

). I tried setting both of them equal to

https://payload-nextjs-practice.vercel.app

which is the prod URL, but it didn't work.



I validated the

MONGODB_URI

and

PAYLOAD_SECRET

variables, and they're all the same both in my local and in prod.



This is the log from Vercel when trying to go to

/admin

in prod:


APIError: The collection with slug pages can't be found.
    at new ExtendableError (/var/task/node_modules/payload/dist/errors/APIError.js:22:15)
    at new APIError (/var/task/node_modules/payload/dist/errors/APIError.js:38:9)
    at findLocal (/var/task/node_modules/payload/dist/collections/operations/local/find.js:16:15)
    at BasePayload.find (/var/task/node_modules/payload/dist/payload.js:53:20)
    at getServerSideProps (/var/task/.next/server/pages/[...slug].js:662:56)
    at /var/task/node_modules/next/dist/server/render.js:508:110
    at /var/task/node_modules/next/dist/server/lib/trace/tracer.js:66:32
    at NoopContextManager.with (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7054)
    at ContextAPI.with (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:517)
    at NoopTracer.startActiveSpan (/var/task/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18022) {
  status: 500,
  data: null,
  isPublic: false,
  isOperational: true,
  page: '/admin'
}
RequestId: 85b732a5-7104-4aa2-b3ed-80bc106b494e Error: Runtime exited with error: exit status 1
Runtime.ExitError
  • default discord avatar
    notchr2 years ago

    Not super familiar with vercel but



    You set your server url initially to localhost:3000



    but then you used

    https://payload-nextjs-practice.vercel.app

    Are you pointing it at port :3000 on vercel

  • default discord avatar
    juansebastianmendoza2 years ago

    yes, it is pointing at that same port

  • default discord avatar
    badjab3262 years ago

    In prod I'm pretty sure you have to run the build command first then add a new variable NODE_ENV=production

  • default discord avatar
    notchr2 years ago

    It's possible they aren't running with payload prod instance with npm run serve



    Which then wouldnt include that prod env

  • discord user avatar
    jarrod_not_jared
    2 years ago
    @258416232506589186

    vercel does not host custom servers, you would have to host this approach another way - like DigitalOcean. There are a couple other ways to host Payload, we have our newly released cloud platform that you could try, we also released our serverless approach that can be deployed on vercel alongside NextJS



    Cloud:

    https://payloadcms.com/new

    Serverless approach:

    https://github.com/payloadcms/next-payload
Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.