question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Best practice for API Route environment variables

See original GitHub issue

Question about Next.js

I am currently in the process for updating my app to 9. I love the initiative behind api routes. One thing that isn’t clear here is the best way to load environment variables in to the app.

Is there anything specific about Next.js I should bare in mind when setting them?

I previously had the variables loaded in to an .env file

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
tim-phillipscommented, Dec 18, 2019

@powderham did you ask this question elsewhere? would be helpful if you shared a link

4reactions
kachkaevcommented, Jul 21, 2019

Please use StackOverflow or https://spectrum.chat/next-js for questions. GitHub issues are for reporting bugs and requesting features. The issue template you’ve edited states this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Best practice for API Route environment variables #8046
I love the initiative behind api routes. One thing that isn't clear here is the best way to load environment variables in to...
Read more >
Environment variables & Its best practices
The most common use of environment variables is to set up different configuration options for different programming environments. Environment ...
Read more >
Basic Features: Environment Variables
Learn to add and access environment variables in your Next.js application. ... allowing you to use them in Next.js data fetching methods and...
Read more >
Environment Variables in Next.js
Conclusion. For local development, you need a file called .env.local which contains all environment variables available for API routes and your server.
Read more >
Environment Variables
It is a good practice to store runtime configuration data, such as API keys, in environment variables. When working locally Enhance supports loading ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found