-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
Unable to extend env when ProcessEnv
has been manipulated
#1132
Comments
Hi @ehyland, This seems to be a bug with import {spawn} from 'node:child_process';
import "@remix-run/node";
spawn('echo', ['example'], {
env: {
DATABASE_URL: 'DATABASE_URL'
}
});
The problem is: the interface merging done by I am not sure whether Remix did intend to force users into specifying I would suggest one of the following:
import { execa, type Options } from 'execa';
import '@remix-run/node'
const $ = execa({
stdio: "inherit",
extendEnv: true,
env: {
DATABASE_URL: 'DATABASE_URL'
} as unknown as Options['env'],
}); |
@ehyland Did this fix your issue? |
Hi @ehmicky, thanks for your response there I got around this by setting I can see this from both sides. While I would prefer they did not extend In the remix app environment that they control But it has an unintended consequence that if for some reason you want to define Given the execa APIs |
Node.js uses As mentioned above, this problem is not specific to Execa: the same issue happens with However, I would recommend opening an issue with Remix to make |
Yeah okay, makes sense to follow |
I created an issue at remix-run/remix#9718 |
We're working on providing with a patch for this issue at #1141 |
When a non optional property has been defined on
ProcessEnv
by interface merging, it is not possible to use execa'senv
&extendEnv
options to add additional environment variables to execa process.Typescript playground example
Example
Suggestion
Instead of
env
option being typed astypeof import('node:process').env
. Maybe it should be typed asRecord<string, string | undefined>
The text was updated successfully, but these errors were encountered: