motdotla / dotenv-expand

Variable expansion for dotenv. Expand variables already on your machine for use in your .env file.
https://dotenvx.com
BSD 2-Clause "Simplified" License
953 stars 95 forks source link

TypeError: Cannot read properties of undefined (reading 'split') #80

Closed NukeJS closed 8 months ago

NukeJS commented 2 years ago
[0] D:\dev\REDACTED\node_modules\dotenv-expand\lib\main.js:20
[0]       const keyParts = parts[2].split(':-')
[0]                                 ^
[0] 
[0] TypeError: Cannot read properties of undefined (reading 'split')
[0]     at D:\dev\REDACTED\node_modules\dotenv-expand\lib\main.js:20:33
[0]     at Array.reduce (<anonymous>)
[0]     at _interpolate (D:\dev\script\publiek\node_modules\dotenv-expand\lib\main.js:6:18)
[0]     at Object.expand (D:\dev\script\publiek\node_modules\dotenv-expand\lib\main.js:50:32)
[0]     at Object.<anonymous> (D:\dev\script\publiek\bs-config.js:1:26)    
[0]     at Module._compile (node:internal/modules/cjs/loader:1120:14)      
[0]     at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
[0]     at Module.load (node:internal/modules/cjs/loader:998:32)
[0]     at Module._load (node:internal/modules/cjs/loader:839:12)
[0]     at Module.require (node:internal/modules/cjs/loader:1022:19)       
[0]
[0] Node.js v18.7.0

If I remove the following environment variables, it doesn't throw the error:

AUTH_KEY='.kZh`>4[,[DDU-*Jt+[;8-,@K=,9%;F9KsoXqOE)gpG^X!{)Q+/9Fc(QF}i[NEi!'
SECURE_AUTH_KEY='=;+=CNy3)-D=zI6gRP2w$B@0K;Y]e^EFnCmx$Dx?;.9wf-rgk1BcTR0]JtY<S:b_'
LOGGED_IN_KEY='MUcKSGSY@HCON<1S_siWTP`DgS*Ug],mu]SkqI|7V2eOk9:>&fw;>HEwms`D8E2H'
NONCE_KEY='m]zjzfRItw2gs[2:{p{ugENyFw9m)tH6_VCQzer`*noVaI<vqa3?FZ9+6U;K#Bfd'
AUTH_SALT='#la__nK?IxNlQ%`5q&DpcZ>Munx=[1-AMgAcwmPkToxTaB?kgdF5y`A8m=Oa-B!)'
SECURE_AUTH_SALT='xlC&*<j4J<d._<JKH0RBJV!4(ZQEN-+&!0p137<g*hdY2H4xk?/;KO1$(W{:Wc}Q'
LOGGED_IN_SALT='?$6)m*xhTVewc#NVVgxX%eBhJjoHYzpXFg=gzn[rWXPLj5UWj@z$/UDm8o79n/p%'
NONCE_SALT='@}:[4#g%[R-CFR});bY(Z[KcDQDsVn2_y4cSdU<Mjy!c^F`G<!Ks7]kbS]N1:bP:'
moselhy commented 2 years ago

Duplicate of #65

motdotla commented 8 months ago

this is fixed in v11.0.0

@NukeJS here is a PR demonstrating your variables: https://github.com/motdotla/dotenv-expand/pull/110/files

(with the caveat that $ must be escaped)