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

RangeError: Maximum call stack size exceeded when a .env file has environment variable with default values #13399

Closed
7 tasks done
hgouveia opened this issue Jun 1, 2023 · 3 comments
Labels
bug: upstream Bug in a dependency of Vite p2-edge-case Bug, but has workaround or limited in scope (priority)

Comments

@hgouveia
Copy link

hgouveia commented Jun 1, 2023

Describe the bug

if you have a .env file in your project and this has environment variable with default values, you will get this error

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
RangeError: Maximum call stack size exceeded
    at RegExp.exec (<anonymous>)
    at file://test-app/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:36830:54
    at Array.reduce (<anonymous>)
    at _interpolate (file://test-app/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:36829:18)
    at file://test-app/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:36863:15
    at Array.reduce (<anonymous>)
    at _interpolate (file://test-app/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:36829:18)
    at file://test-app/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:36863:15
    at Array.reduce (<anonymous>)
    at _interpolate (file://test-app/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:36829:18)

this only happened to me in Linux and my ci with docker, this does not happen on windows (my main machine)

Reproduction

https://stackblitz.com/edit/vitejs-vite-brtwpg?file=.env

Steps to reproduce

  • create a empty project npm init -y
  • install vite
  • create a .env file with this content
MY_SECRET=${MY_SECRET:-}
  • run npx vite

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.2 LTS 22.04.2 LTS (Jammy Jellyfish)
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 29.10 GB / 31.31 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node
    Yarn: 1.22.19 - /mnt/d/programas/nodejs/yarn
    npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm
  npmPackages:
    vitest: ^0.31.2 => 0.31.2

Used Package Manager

npm

Logs

$ vite

  VITE v4.3.9  ready in 826 ms

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose
  ➜  press h to show help
9:54:42 AM [vite] .env changed, restarting server...
9:54:42 AM [vite] server restarted.
9:54:49 AM [vite] .env changed, restarting server...
9:54:49 AM [vite] Maximum call stack size exceeded
9:54:49 AM [vite] server restart failed

Validations

@stackblitz
Copy link

stackblitz bot commented Jun 1, 2023

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@bluwy
Copy link
Member

bluwy commented Jun 2, 2023

Seems like an upstream issue motdotla/dotenv-expand#98

@sapphi-red sapphi-red added bug: upstream Bug in a dependency of Vite p3-minor-bug An edge case that only affects very specific usage (priority) p2-edge-case Bug, but has workaround or limited in scope (priority) and removed p3-minor-bug An edge case that only affects very specific usage (priority) labels Jun 4, 2023
@bluwy
Copy link
Member

bluwy commented Nov 12, 2023

Closing this as there's not much we can do. When this is fixed upstream, we'll update the dotenv dependency.

@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Nov 12, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite p2-edge-case Bug, but has workaround or limited in scope (priority)
Projects
None yet
Development

No branches or pull requests

3 participants