Install-Remotely.ps1 The remote server returned an error: (400) Bad Request. For a re-install
- Dominant language
- C#
- Stars
- 5.1k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
The remote server returned an error: (400) Bad Request.
Invoke-RestMethod : The remote server returned an error: (400) Bad Request.
At Install-Remotely.ps1:184 char:3
+ Invoke-RestMethod -Method Post -ContentType "application/json ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
**To Reproduce**
Run Install-Remotely.ps1 on a machine with Remotley already installed
**Remotely Version**
Server (can be found on about page):2024.08.07.0819
Agent (can be found in device card):
**Expected Behavior**
Not error and start service
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS] Windows 11
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone13]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional Context**
Option could be a try catch around the Invoke-RestMethod
try {
Invoke-RestMethod -Method Post -ContentType "application/json" -Uri "$HostName/api/devices" -Body $Body
} catch {
if($_.ErrorDetails.Message) {
Write-Log $_.ErrorDetails.Message
} else {
Write-Log $_
}
}
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with Install-Remotely.ps1 at line 184 and inspect the Invoke-RestMethod POST to /api/devices. Reproduce by running the script on a machine where Remotely is already installed, then verify the behavior against the expected result that the installation does not fail with HTTP 400 and the service starts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- powershell
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100