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

.env Hot Reloading Error (Astro v5 Beta) #12107

Closed
1 task done
neelsudhakaran opened this issue Oct 2, 2024 · 5 comments
Closed
1 task done

.env Hot Reloading Error (Astro v5 Beta) #12107

neelsudhakaran opened this issue Oct 2, 2024 · 5 comments
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: dev Related to `astro dev` CLI command (scope)

Comments

@neelsudhakaran
Copy link

Astro Info

Astro                    v5.0.0-beta.3
Node                     v20.17.0
System                   macOS (arm64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

When modifying a .env file while the dev server is running, a Vite error is logged to the console.

[ERROR] [vite] Error: cannot print server URLs before server.listen is called.

Sometimes (I can't tell if it's when you make multiple saves in rapid succession or something else), you also get the following Node error thrown.

(node:84966) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)

As far as I can tell (and I'm still using environment variables the old way) the environment variables, both with the PUBLIC_ prefix and without, still work.

What's the expected result?

I don't think these warnings, if true, are supposed to print.

Link to Minimal Reproducible Example

https://github.com/neelsudhakaran/astro-server-listen-error

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Oct 2, 2024
@ematipico
Copy link
Member

@neelsudhakaran your reproduction doesn't have an .env file, can you add it?

@ematipico ematipico added the needs repro Issue needs a reproduction label Oct 3, 2024
Copy link
Contributor

github-actions bot commented Oct 3, 2024

Hello @neelsudhakaran. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Oct 3, 2024
@neelsudhakaran
Copy link
Author

Sorry about that @ematipico! I added the .env to the repository. Any edits to the file (or even just saving it) brings up that error for me.

@ematipico ematipico added needs triage Issue needs to be triaged and removed needs repro Issue needs a reproduction labels Oct 4, 2024
@ascorbic ascorbic added - P3: minor bug An edge case that only affects very specific usage (priority) feat: dev Related to `astro dev` CLI command (scope) and removed needs triage Issue needs to be triaged labels Oct 4, 2024
@ascorbic
Copy link
Contributor

ascorbic commented Oct 4, 2024

Fixed in #12127

@ascorbic ascorbic closed this as completed Oct 4, 2024
@neelsudhakaran
Copy link
Author

It was really interesting to read about the fix—thank you so much by the way!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P3: minor bug An edge case that only affects very specific usage (priority) feat: dev Related to `astro dev` CLI command (scope)
Projects
None yet
Development

No branches or pull requests

3 participants