500 error in Nextjs when fetching api

Helllo, I’m developing an app in nextjs to allow customers to download products providing the payment ID. The issue is that now the site is giving 500 internal server error only in netlify production. It’s not the first time this happened, the previous time I fixed it by changing the API url. The site is using SSR. You can test it by going to https://mmodsgtav.netlify.app/orders/whatever. As I said, this is only happening on deployment, in local it works fine. Thanks!

I’m getting error 404 and not 500. Is this fixed?

I found out that the issue was coming from the API url. Somehow when the app was deployed i was getting a connection error so the json object was empty and therefore the content couldn’t be loaded, causing a 500 error. I changed the API url to another domain I have and now is working fine. Do you know why can this be happening? Thanks!

Can’t say without seeing it happen, unfortunately. And if some other server is sending a 500 response, I’ve even less of an idea on what could be happening.

Finally solved, it was because on the API domain I had activated bot prevention option on Cloudflare so therefore Netlify’s server api requests were being blocked by Cloudflare.

Thanks for coming back and sharing this solution! Glad everything is working now. Happy building :rocket: