aws-toolkit-vscode
aws-toolkit-vscode copied to clipboard
codecatalyst (Windows): "Open Dev Environment" fails, ps1 script not compatible with "Constrained Language Mode" ?
Problem
Im trying to use the "Open Dev Environment" command to open a codecatalyst dev environment on my laptop. New VS Code window opens but it is then closed and you can barely see that there was an error message in the output.
Steps to reproduce the issue
See above. Trying to troubleshoot the issue a bit following seems to happen:
- The extensions adds an entry in the .ssh/config file in the user folder. Entry in the config looks something like this:
# Created by AWS Toolkit for VSCode. https://github.com/aws/aws-toolkit-vscode
Host aws-devenv-*
ForwardAgent yes
AddKeysToAgent yes
StrictHostKeyChecking accept-new
ProxyCommand "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy RemoteSigned -File c:\Users\xxxx\AppData\Roaming\Code\User\globalStorage\amazonwebservices.aws-toolkit-vscode\codecatalyst_connect.ps1" %h`
- Looking at the "codecatalyst_connect.ps1" powershell script it seems to be doing many things for example reading information from environment variables like so:
$global:logFileLocation = [Environment]::GetEnvironmentVariable("LOG_FILE_LOCATION")
-
Powershell supports the notion of "language modes" and it seems to be common that in corporate environments Powershell scripts are configured to run in the "Constrained Language Mode" (see https://devblogs.microsoft.com/powershell/powershell-constrained-language-mode/). This is the configuration on my laptop where this issue shows up.
-
Looks like the "codecatalyst_connect.ps1" may not be currently compatible with the "Constrained Language Mode". Note that this is just a guess and the problem could well be somewhere else.
Expected behavior
Use codecatalyst dev environments in VS Code normally also when PowerShell is configured to run in the "Constrained Language Mode".
System details (run AWS: About
and/or Amazon Q: About
)
- OS: Windows 11 Enterprise 22H2
- Visual Studio Code version: 1.92.0
- AWS Toolkit version: v3.18.0
- Amazon Q version: