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

Install-Remotely.ps1 The remote server returned an error: (400) Bad Request. For a re-install #930

Open
littleearth opened this issue Aug 23, 2024 · 0 comments

Comments

@littleearth
Copy link

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 $_
}
}

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

1 participant