Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.local.env file does not load in development #43753

Closed
1 task done
mmaksi opened this issue Dec 6, 2022 · 3 comments
Closed
1 task done

.local.env file does not load in development #43753

mmaksi opened this issue Dec 6, 2022 · 3 comments
Labels
bug Issue was opened via the bug report template.

Comments

@mmaksi
Copy link

mmaksi commented Dec 6, 2022

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

error - Failed to load env from E:\Nextflix\Nextflix.env.local TypeError: Cannot read properties of undefined (reading 'split')
at E:\Nextflix\Nextflix\node_modules@next\env\dist\index.js:1:311
at Array.reduce ()
at _interpolate (E:\Nextflix\Nextflix\node_modules@next\env\dist\index.js:1:125)
at expand (E:\Nextflix\Nextflix\node_modules@next\env\dist\index.js:1:709)
at processEnv (E:\Nextflix\Nextflix\node_modules@next\env\dist\index.js:1:3706)
at Module.loadEnvConfig (E:\Nextflix\Nextflix\node_modules@next\env\dist\index.js:1:4660)
at Object.loadConfig [as default] (E:\Nextflix\Nextflix\node_modules\next\dist\server\config.js:41:21)
at NextServer.loadConfig (E:\Nextflix\Nextflix\node_modules\next\dist\server\next.js:146:36)
at NextServer.getServer (E:\Nextflix\Nextflix\node_modules\next\dist\server\next.js:150:39)
at NextServer.prepare (E:\Nextflix\Nextflix\node_modules\next\dist\server\next.js:130:35)

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/mmaksi/Nextflix

To Reproduce

Step 1: npm install

Step 2: npm run dev

Describe the Bug

.env.local file unexpectedly stopped working. It used to be working fine in the morning but no longer works in the morning. It started throwing an error: "Cannot read .local.env file" without any change in the code.

Expected Behavior

I expect the environment variables to be loaded just fine in my application.

Which browser are you using? (if relevant)

Google Chrome

How are you deploying your application? (if relevant)

No response

@mmaksi mmaksi added the bug Issue was opened via the bug report template. label Dec 6, 2022
@balazsorban44
Copy link
Member

The file needs to be called .env.local for Next.js to pick it up. Otherwise, this sounds like a duplicate of: #36691

If you think it's a different issue, please open a new one with an attached reproduction. (The one you linked to does not have the file in question.)

@mmaksi
Copy link
Author

mmaksi commented Dec 6, 2022

The file needs to be called .env.local for Next.js to pick it up. Otherwise, this sounds like a duplicate of: #36691

If you think it's a different issue, please open a new one with an attached reproduction. (The one you linked to does not have the file in question.)

Yes! Sorry it's .env.local but I mistyped it and was too busy to correct it!

Also I'm not trying to escape a $ sign as it is a part of an API key: "ase#44$$@(&$#@3e324#cretthisisasecret1234"

@github-actions
Copy link
Contributor

github-actions bot commented Jan 6, 2023

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

No branches or pull requests

2 participants