Closed aviramha closed 1 year ago
It might be that mirrord doesn't even load into it because they use dotenv
script that loads it from file on the pod.
It might be that we need to add SIP Patching?
Does this only happen on vscode or also with the CLI?
Trying to reproduce in https://github.com/t4lz/npm-dotenv - could not reproduce the issue so far.
Using dotenv
with a config that points to a path that exists on the cluster, because the default path would not exist there. I am assuming this is also what is done where this issue was discovered.
@t4lz Thanks for posting the project. The dotenv is external (meaning they use the cli to run their code)
Add to your package.json
a script that does dotenv -e FILE node index.js
and then in your launch json run that.
Ohh, so they're running dotenv-cli
, right?
Add to your
package.json
a script that doesdotenv -e FILE node index.js
and then in your launch json run that.
Did that and it still doesn't reproduce for me. Trying to think what I could be doing differently.
Add to your
package.json
a script that doesdotenv -e FILE node index.js
and then in your launch json run that.Did that and it still doesn't reproduce for me. Trying to think what I could be doing differently.
There's a specific launch configuration for npm run script. They used it.
You can also do it if you go to package.json
from the IDE and click debug next to the script you added.
Ignore the scripts, just using this as an example :) (You can see a small debug button then you can choose what script to run)
When running that way (clicking on the little "Debug" button above scripts
), a run configuration with request type attach
is used by vs-code:
And the env
launch configuration field is only available for launch configurations of request type launch
.
This of course means the layer is not injected into the process. This is not a SIP issue, it also wouldn't work on Linux.
Trying to think how we could support this way of launching. I don't think simply changing the request type would do, because it seems this configuration does not contain the information of which file to run etc. Also probably it's a different flow for the IDE.
There's a specific launch configuration for npm run script. They used it.
Am I not using it in the commit I linked above? (not talking about the debug button in package.json
now, but about vscode's launch.json
)
I followed vscode's Launch configuration support for 'npm' and other tools documentation.
They had something like this:
{
"command": "npm run build:prod",
"name": "Run npm start",
"request": "launch",
"type": "node-terminal"
},
When running using npm/node the remote env isn't fetched.