Next.js + RTK Query Server-Side-Rendering throws 500 error on Deployment but works fine after build locally

99 Views Asked by At

I am building an app using NextJS and RTK Query. Locally after the build everything works as expected. However after deploy on Vercel the server-side rendering logic (getServerSideProps for 2 pages) throws 500 error.

I was following redux documentation and example attached to redux documentation.

I have added rehydration to all api services. I have created wrapper around the store. I used wrapper in getServerSideProps function in Home component and added logic for next to call the api's on the server side.

Locally: in the Home component props, I receive all data as expected. The NextJS server sends the premade HTML as expected. premade HTML

Deployed: throws 500 error: for Home component (page) But all the other pages that doesn't use SSR works 100% fine.

1

There are 1 best solutions below

0
seniorPomidor On

I found solution here. So, I had a version 13.5.4 of Next and downgraded it to 13.5.3. Additionally I installed core.js via "npm i core-js". One of these or both of them solved the problem.