- You cant destructure
process.envin next.js apps
Note: In order to keep server-only secrets safe, Next.js replaces
process.env.*with the correct values at build time. This means thatprocess.envis not a standard JavaScript object, so you’re not able to use object destructuring. Environment variables must be referenced as e.g.process.env.PUBLISHABLE_KEY, notconst { PUBLISHABLE_KEY } = process.env.