nextjs Failed to load env TypeError: Cannot read properties of undefined (reading 'split') #36691
Open
1 task done
Labels
Upstream
Related to using Next.js with a third-party dependency. (e.g., React, UI/icon libraries, etc.).
Verify canary release
Provide environment information
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 21.4.0: Fri Mar 18 00:45:05 PDT 2022; root:xnu-8020.101.4~15/RELEASE_X86_64
Binaries:
Node: 16.13.1
npm: 7.24.2
Yarn: 1.22.15
pnpm: 6.11.0
Relevant packages:
next: 12.1.7-canary.1
react: 17.0.2
react-dom: 17.0.2
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
Executing on local laptop
Describe the Bug
On starting next with the command npm run dev ("dev": "next") the error message is show:
error - Failed to load env from /Users/path/.env.development.local TypeError: Cannot read properties of undefined (reading 'split')
The simple .env file has
SH_API_BASEURL='http://localhost:3010/api/v1'
NEXT_PUBLIC_SH_API_BASEURL = 'http://localhost:3010/api/v1'
NEXTAUTH_URL=http://localhost:3000
SECRET_COOKIE_PASSWORD=someText
NEXTAUTH_SECRET=AY_PqQ/gmFH6L@:z{szxm.2;~xN:RfD;Rwb`%c/$,/$sometext
JWT_SIGNING_PRIVATE_KEY=&/$someText
If I remove the $ from the keys the .env file will load so the issue is when there is $ in the keys. As this was possible in 12.0.6 it should be possible in the current version.
Expected Behavior
Next 12.0.6 is able to load the .env file without an issue but the current fails to load the .env.
I expect 12.1.16 or 12.1.7-canary.1 to be able to parse the .env file with $ in the value
To Reproduce
To reproduce run npm i next
The text was updated successfully, but these errors were encountered: