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

292
Vistas
Environment variable not working in next js (12.2.2)

I followed the steps from official documentation but I'm facing problem, this is how I did :

next.config.js

const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  env : {
    MORALIS_ID: 'moralisId',
    MORALIS_SERVER: 'moralisServer'
  }
}
module.exports = nextConfig

And I call it like that :

<MoralisProvider serverUrl={process.env.MORALIS_SERVER} appId={process.env.MORALIS_ID}>
                <Component {...pageProps} />
            </MoralisProvider>

But when I console.log, I've got undefined and the error appear : ReactMoralisError: Provide a "appId" provided to <MoralisProvider>

So Next doesn't know the id.

What I did wrong ?

EDIT => even in my .env it doesn't work

EDIT AGAIN => I restart the server and it works, sorry guys and thanks for your time

about 4 years ago · Santiago Gelvez
2 Respuestas
Responde la pregunta

0

I restart the server and it works, sorry guys and thanks for your time

about 4 years ago · Santiago Gelvez Denunciar

0

Instead of next.config.js, Use .env.local, go throught https://nextjs.org/docs/basic-features/environment-variables

about 4 years ago · Santiago Gelvez Denunciar
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