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.

Deploy Payload on Netlify and vercel

default discord avatar
daniel50264542 years ago
8

Hello, everyone, hello Payload


i've been trying to deploy my payload website on netlify for a while now but i haven't had any luck. this is the error i've been getting is on the image.


The link to my slug.tsx is here :


https://github.com/neo1415/nem-health/blob/master/pages/%5B...slug%5D.tsx

and as the issue might be with my envs , heres a link to the example.env which is more or less what i'm using :


https://github.com/neo1415/nem-health/blob/master/.env.example

please, i really need help on this

  • default discord avatar
    sqveeze.2 years ago

    Have you added your envs in netlify? Issue might be that your fetch doesnt receive the env vars for server url.

  • default discord avatar
    daniel50264542 years ago

    yeah i tried that. it's still the same error



    i've added the variables, the error i'm getting now is this

  • discord user avatar
    jarrod_not_jared
    2 years ago

    you are trying to build a static site, deploying next and payload on the same server



    chicken and egg problem



    The next and payload deployed as 1 only works when using SSR. Can you tell me what your setup is, are you attempting to deploy next

    and

    payload on netlify?

  • default discord avatar
    daniel50264542 years ago

    i'm just trying to get it online so I can view it in production. railway, vercel, netlify. doesn't matter to me right now.



    @281120856527077378

    is it impossible to deploy both on the same server ?

  • default discord avatar
    sqveeze.2 years ago

    Its possible but what you tryin to do is not possible.


    1) app starts build


    2) app requires some data from basically itself on the /api route


    3) fails cause it cant request data from itself before building and running

  • default discord avatar
    daniel50264542 years ago

    So what do you suggest will work

  • default discord avatar
    sqveeze.2 years ago

    Use getserversideprops instead of static

  • discord user avatar
    jarrod_not_jared
    2 years ago

    Yep, you can check out this repo:

    https://github.com/payloadcms/nextjs-custom-server
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.