Next.js Discord

Discord Forum

Pages migration to App Router

Unanswered
Satin posted this in #help-forum
Open in Discord
SatinOP
We are in the process of migrating from pages to app router. Our setup is one to many deployment structure with k8s. Therefore we utilize runtime environment variables with pages, but now with app router that breaks. Issue is, we are incrementally moving over components to app router, therefore we find our selves in the predicament where we have on component used in pages and in app router, and getting errors at runtime.

How can we use runtime variables both in app router, but also in pages? We can't use publicRuntimeConfig because if our main component calls it in app router, it breaks, but works in pages.

0 Replies