Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

293
Visualizações
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 Respostas
Responde à pergunta

0

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

about 4 years ago · Santiago Gelvez Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda