Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

335
Vistas
how to set heroku env variables to appear in NextJS app?

Somewhat unfamiliar ground for me, but I'm trying to set a banner on my page that says "Current Env: REVIEW" or "Current Env: STAGING" depending on what phase of my deployment process I'm on in Heroku.

Currently, I have environment variables on Heroku like this: CURRENT_ENV: REVIEW. However, when I try to access the variables with the logic below, they come up as undefined in my deployed app. I'm curious what the proper approach is to get these variables set up correctly so my app has the ability to detect whether it's in review or staging.

_app.ts

  const getCurrentEnv = (): string => {
    console.log(process.env.NEXT_PUBLIC_CURRENT_ENV, process.env.CURRENT_ENV);
    // while deployed on heroku logs: PRODUCTION, undefined

    return process.env.NEXT_PUBLIC_CURRENT_ENV === 'DEVELOPMENT'
      ? process.env.NEXT_PUBLIC_CURRENT_ENV
      : process.env.CURRENT_ENV;
  };

.env.production

NEXT_PUBLIC_CURRENT_ENV="PRODUCTION"

.env.development

NEXT_PUBLIC_CURRENT_ENV="DEVELOPMENT"
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda