Replies: 5 comments 2 replies
-
I think Next.js is trying to invoke a serverless function at pages/api/projects, which does not exist. I'm not sure why it would work locally. It probably would be better to use the Payload Local API inside of getStaticProps or getServerSideProps. |
Beta Was this translation helpful? Give feedback.
-
Oh shit I read through this again you said Payload Local API, right I can use that but then I dont really know on how to cause although the docs mention it I still dont know how would I use it in real world situation. |
Beta Was this translation helpful? Give feedback.
-
@wbjohn after you forked my project it deployed and gave me this error
|
Beta Was this translation helpful? Give feedback.
-
Hey @outdatedx — I think I know what's going on for you. It's a combination of a few different things. Firstly, Vercel is not a typical Node host. It doesn't even run your You can deploy Express apps on Vercel, but they recommend against it: https://vercel.com/guides/using-express-with-vercel Basically, a TL;DR from the above link is that even if you set up your project properly as an Express app able to be deployed on Vercel, you are basically deploying your entire Express app, all routes, and everything, as one giant serverless function. To contrast, when you deploy a NextJS site on Vercel, it actually splits out every one of your server-rendered pages into their own serverless function. The error you are seeing is because your You should consider deploying to something like Heroku or DigitalOcean Apps instead. On those services, you'll have a true Express server that runs all the time and is only initialized once, rather than each time a function is invoked. But, if you do decide you want to continue to deploy to Vercel, the above link shows you a few steps that you need to complete yet:
This is all found on the above link here. I'm going to go ahead and move this thread to a Discussion as it's actually not an issue with Payload per se - rather, it's a configuration and infrastructure issue. The good news is that you can deploy to Vercel if you want to, but in reality you're probably better off with a traditional cloud server platform rather than a serverless platform like Vercel. Does this clear things up for you? |
Beta Was this translation helpful? Give feedback.
-
This project would gain lots of public if we could deploy easily to Vercel. A way to run all back-end code in their serverless functions. |
Beta Was this translation helpful? Give feedback.
-
Bug Report
I'm using vercel for my builds but then I get a 500: Internal Error I went back and check the references I had I saw I was using
getStaticProps: GetStaticProps
instead ofgetServerSideProps: GetServerSideProps
but it still gave me a error so I went back to get static props.This is the build logs
Expected Behavior
It should work as it did locally
Current Behavior
It gives me a 500: Internal Error.
I made my repo public for a lil while was wondering if anyone and send a pull request to help me.
Beta Was this translation helpful? Give feedback.
All reactions