Next.js Discord

Discord Forum

Deploy static page with different api url for each env

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
Hi

Im building and deploying a NextJS application that retrieves content for a cms.
Since this content is mostly static this is done in the old page router with getStaticProps and getStaticPath.

Our pipeline is on gitlab, where images is normally build once and then deployed.
When you have mainly static pages and when we only build once it not possible to target different API for dev, test, stage / prod etc.

What do people do in this case?
- Change your pipeline to build a new image for each env?
- Change your pages to be server side rendered on request instead so you can read runtime ENVs.This would mean switching from getStaticProps to getServerSideProps.

Or what would be the best approach in NextJS context ?

0 Replies