Deploying to Vercel

default discord avatar
tilelast year
12

Hey, I keep running into an issue with Vercel deployments. When I set build as the public directory in Vercel the deployment is successful but it only shows an empty page. From what I've found out so far the issue is that payload builds result in two output directories, (dist and build) (

https://payloadcms.com/docs/production/deployment

), while Vercel only serves files from one output directory (

https://vercel.com/docs/concepts/deployments/configure-a-build

). Can anyone here who has deployed to vercel help me out with this or maybe send me a tutorial? Thank you so much!

  • default discord avatar
    notchrlast year

    @tile I do not have experience with vercel, I'm sure a bunch of folks do, but I did find this example Repo that may be relevant

    https://github.com/payloadcms/next-payload


    Which was linked from

    https://nextjs-vercel.payloadcms.com/
  • default discord avatar
    tilelast year

    Never worked with next but I don't think this is a solution as I'm just trying to get the default create-payload-app running, I already have a separate sveltekit project on vercel for my frontend

  • default discord avatar
    notchrlast year

    Ah right, I don't know next either, however that example was deployed to vercel by the payload team



    So it may have some vercel-related infromation?



    My guess is, to handle both build directories, youll need to configure vercel a little

    https://vercel.com/docs/build-output-api/v3/configuration
  • default discord avatar
    tilelast year

    Yes I also think I'll just have to change something in the Vercel config not on the Payload side. Unfortunately the repo doesn't seem to include a vercel config file. I'd ask this in a Vercel group but since this issue should come up every time someone trys to deploy payload to vercel I thought someone here might have already run into it

  • default discord avatar
    notchrlast year

    Hmm check out

    https://discord.com/channels/967097582721572934/1088447315385270322


    You can also surch 'vercel deploy' in the top right to see all discussion related to that

  • default discord avatar
    tilelast year

    I couldn't find a solution and I've moved to Railway now

  • discord user avatar
    tylandavis
    last year

    hey @tile, if you are using the default

    create-payload-app

    , it won't be able to be deployed on Vercel's platform. Payload runs on Express, and since Vercel is a serverless platform, there are some less-than-ideal workarounds needed to run an Express app on Vercel.



    More on that here:

    https://vercel.com/guides/using-express-with-vercel

    I see you are using sveltekit for your frontend, but if you wanted to use Next, you can use the

    next-payload

    package to deploy Payload severlessly within a NextJS application, which is deployable on Vercel.



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

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

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