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

Request failed with status code 400 #3

Open
tdmalone opened this issue Dec 19, 2020 · 16 comments
Open

Request failed with status code 400 #3

tdmalone opened this issue Dec 19, 2020 · 16 comments

Comments

@tdmalone
Copy link

I consistently get the following error a couple of seconds after attempting to start a session:

image

  • My region is set to ap-southeast-2 (I tried with us-east-1 too just in case)
  • I have set a profile that is authenticated via MFA, and has a session token present (the profile has admin privileges and works with the AWS CLI)
  • I have the Session Manager plugin installed, and successfully create Session Manager sessions regularly

Where would you suggest looking next to work out how to resolve this error?

@iann0036
Copy link
Owner

I saw this a couple of times but couldn't pin it down. Could you try restarting the environment from the console?

@ex-rookie
Copy link

From the "Console" tab of "Help -> Toggle Developer Tools" window in VSCode:

...
{status: 400, statusText: "Bad Request", headers: {…}, config: {…}, request:
...
data:
code: "InvalidStatusException"
message: "Expected the environment status to be in SUSPENDED."
...

Restarted VSCode and tried again, the Session went to RUNNING state this time(from CONNECTING state during the 400 Error above), but it was failed with the below error and got removed from the session list:

...
The terminal process failed to launch: A native exception occurred during launch (File not found: ).
...

@iann0036
Copy link
Owner

Hey @ex-rookie,

Thanks for helping out!

Are you able to open your Terminal/CMD and simply run session-manager-plugin --version? That error implies the Session Manager plugin is not available in your $PATH.

@iann0036
Copy link
Owner

I've also published 0.1.5 to the extension marketplace that adds a bunch of debugging.

@ex-rookie
Copy link

Thanks Ian, the session-manager-plugin does seem to show up correctly for both cmd and the wsl terminals.

$ session-manager-plugin --version
1.2.30.0

I am thinking this is more related to the terminal launch itself (when done by the extension, and could be a config issue with my environment).

Side note, also had this error when trying to upgrade to 0.1.5:
"ERR Corrupt ZIP: end of central directory record signature not found: validating: Corrupt ZIP: end of central directory record signature not found"

Will read more in the VSCode docs to see which of those hundreds of settings can be tuned better, Windows version (conpty, winpty etc etc), probably not related to this 400 issue, or any issue with the plugin, will keep posted if I find anything new.

@iann0036
Copy link
Owner

Thanks for that. I'm on a Mac so can't really replicate what you're seeing.

Let me know if you find anything.

@tblakex01
Copy link

Hi Ian,

I'm experiencing the same issue, although after updating to 0.1.5 and rebooting I'm not getting the 404 error anymore. The cloudshell shows "connected" but I receive the following error; "The terminal process failed to launch: A native exception occurred during launch (File not found: )". I have a few shells setup already, such as git bash, wsl2, powershell, running on Windows 10 latest version of vscode and the extension. Does the AWS CloudShell get created automatically or do I need to adjust or check any of the terminal.integrated.* settings?

Thanks

@iann0036
Copy link
Owner

iann0036 commented Dec 20, 2020

Hey @tblakex01,

The extension attempts to directly create a terminal using session-manager-plugin as the main process, as per this line.

I'm wondering if this is not a supported action on Windows? My assumption is that the "File not found:" relates to the location of session-manager-plugin? i.e. changing that to C:\\%PROGRAMFILES%\\Amazon\\SessionManagerPlugin\\bin\\session-manager-plugin.exe (or similar) might help

@ex-rookie
Copy link

yes something here apparently, but will need some trial-and-error:
https://code.visualstudio.com/docs/supporting/troubleshoot-terminal-launch

@tblakex01
Copy link

Thanks for the quick reply. I was able to make some progress. If I use the insiders edition of vscode setup with remote wsl and install the extension in wsl, essentially ubuntu, then it works perfectly. This would probably also work in the regular version of vscode, I just needed two versions up to do some testing. Using the tracing on vscode it looks like it tries to grab my local windows env variables, instead of the cloud shell's "cwd" when it loads then after that the error hits that the terminal failed to load and file not found. I'll do some more testing tomorrow and see if I can figure out a way for it to spawn in Windows natively, but I'm perfectly content with it working with WSL. Thanks for creating this extension and former2/console recorder, they are awesome!

@ex-rookie
Copy link

Thanks @tblakex01,

I do have WSL set as well as the default shell (but how do we install the extension in WSL?),

With the environment, there is a flag "terminal.integrated.inheritEnv" that is not support in Windows, so setting it to False has helped some users solve their terminal launch issues in Windows (but did not work for me).

This is the latest I got:

image

Since you have similar platform, probably you have the correct flow to see if that "undefined" is really expected.

@iann0036
Copy link
Owner

Yep, the undefined is expected (logged the wrong thing), so I believe these are the same issue.

For @tblakex01 , if we can figure out a consistent way of spawning the shell regardless of cwd/shell, then we can test for Windows OS and use whatever execution command is best.

@ex-rookie
Copy link

ex-rookie commented Dec 20, 2020

Yes thanks @tblakex01, works with "Remote WSL connection to Local copy of WSL(or with Remote SSH connection to any Linux machine)" with the regular VSCode version as well. A standalone testing of the "createTerminal" API may help to further troubleshoot the Windows part.

iann0036 added a commit that referenced this issue Dec 22, 2020
@iann0036
Copy link
Owner

I've submitted a fix for Windows that should hopefully fix both the 400 error, and the "File not found:" error (assuming session manager plugin installed to default path). Let me know if this fixes your issues.

I've noticed the console height / clear terminal history doesn't seem to be automatic in Windows so please let me know if you see the same also.

@ex-rookie
Copy link

Thanks Ian, that was fast.

So yes, I was able to use the extension seamlessly in below scenarios:

  • "Remote WSL" connection to the Local copy of WSL (Extension installed within the WSL env)
  • "Remote SSH" connection to a remote Linux machine (Extension installed in remote environment)
  • Local installation for VS Code on Windows 10

Did not notice anything unusual with the console height or clear history (using both cmd and WSL options of Integrated terminal, don't think it matters though), but let me know if you wanted to test a specific use case, and I can try that as well.

@iann0036
Copy link
Owner

Neat. Might've just been a local issue then. Thanks for testing!

I'll keep this open for @tblakex01 and/or @tdmalone to confirm.

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

No branches or pull requests

4 participants