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

Cannot upgrade Vike due to hard NODE_ENV failure #1526

Closed
ChristophP opened this issue Feb 28, 2024 · 3 comments
Closed

Cannot upgrade Vike due to hard NODE_ENV failure #1526

ChristophP opened this issue Feb 28, 2024 · 3 comments
Labels

Comments

@ChristophP
Copy link

ChristophP commented Feb 28, 2024

Description

We're currently using Vike 0.4.159 and would like to upgrade.
However, when doing so the following error appears during development.

Error: [vike][Wrong Usage] Vite's development server was instantiated while the environment is set to be a production environment by process.env.NODE_ENV === "local" which is contradictory, see https://vike.dev/NODE_ENV

the reason is that our NODE_ENV is set to local. We cannot easily change this to the legal values since our DB client actually uses NODE_ENV to check which db to connect to. Admittedly coupling NODE_ENV to our environemnts this way is not great and I think we should change it because it is abusing the meaning of NODE_ENV somehow and should use something independent of that. However, this isn't easily done and it'll mean we won't be able to upgrade Vike as long as this is a hard failure.

It seems that this was changed from a warning to a hard error in 0.4.160 and I saw the comment in this line of code f3926bd#diff-ededd76b0d3273090e9e067d374a96da68bc29ac17b347436dc316b89f0e8810R91
so I just wanted to provide a data point that this is indeed for us an upgrade blocker atm.

@brillout
Copy link
Member

Thanks for opening the issue. There seems to be a conundrum. Let me think of a solution.

@brillout
Copy link
Member

The errors are now warnings. Released in 0.4.164. The plan is to make them errors again while enabling users to whitelist NODE_ENV values with a new setting allowNodeEnv.

@ChristophP
Copy link
Author

ChristophP commented Feb 28, 2024

Thanks for doing this so quickly.

The plan is to make them errors again while enabling users to whitelist NODE_ENV values with a new setting

That's a great solution, that would allow user with weird cases (like us :-) ) to deal with it properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants