In a Run/Debug configuration, is there a way to run Node in the context of PowerShell so that I can run a PowerShell command before running the Node interpreter? Follow
Hi,
At work and in our Windows environments in order to authenticate to AWS, first we have to run a command in PowerShell that acquires some sort of credentials and after that we can connect to our AWS services without the need to have AWS access/secret keys.
That command can only run in PowerShell. So at the moment if I start my Node app via Run/Debug, it cannot communicate with a DynamoDB instance I have in AWS. For the time being, I have changed WebStorm's Terminal to use PowerShell, and then run my Node app from there, but ideally I would like to run the command via the Run/Debug command in the context of a PowerShell process and have the PowerShell command that obtains AWS credentials in "Before launch" or in a similar way.
Is this possible to do at the moment?
Thanks,
Behrang
Please sign in to leave a comment.
Hi,
Yes, I think it's possible.
Place these files in the same directory (inside or outside of your project, it doesn't matter):
node-powershell.cmd
node-powershell.ps1
Then specify full path to node-powershell.cmd in "Node interpreter" field in Node.js Run/Debug configuration dialog. It works for me. Hope it'll work for you as well.
Please note it's just a proof-of-concept. Further you can modify node-powershell.ps1 to add there required authentication logic, etc.
--
Sergey