Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
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 answers
Answer question

0

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

about 4 years ago · Santiago Gelvez Report

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!