microsoft / PowerShellForGitHub

Microsoft PowerShell wrapper for GitHub API
Other
584 stars 184 forks source link

Getting started, 400 (Bad Request) #365

Closed Liturgist closed 1 year ago

Liturgist commented 1 year ago

A description of your problem or question

I am trying to get started with PowerShellForGithub. Most commands result in:

PS C:\> Get-GitHubUser
Invoke-WebRequest: C:\Users\myuser\Documents\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubCore.ps1:313
Line |
 313 |              $result = Invoke-WebRequest @params
     |                        ~~~~~~~~~~~~~~~~~~~~~~~~~
     | Response status code does not indicate success: 400 (Bad Request).

Steps to reproduce the issue

Run the Get-GitHubUser command.

Verbose logs showing the problem

PS C:\> Get-GitHubUser -Verbose
VERBOSE: [0.16.1] Executing: Get-GitHubUser -Verbose:$true
VERBOSE: Getting all users
VERBOSE: Accessing [Get] https://github.mycompany.com/api/v3/users [Timeout = 0)]
VERBOSE: GET with 0-byte payload
VERBOSE: received -byte response of content type
VERBOSE: [0.16.1] Executing: Set-TelemetryException -ErrorBucket "Get-GitHubUser"
VERBOSE: Sending telemetry event data to https://dc.services.visualstudio.com/v2/track [Timeout = 0)]
VERBOSE: POST with 1588-byte payload
VERBOSE: received 49-byte response of content type application/json
Invoke-WebRequest: C:\Users\myuser\Documents\PowerShell\Modules\PowerShellForGitHub\0.16.1\GitHubCore.ps1:313
Line |
 313 |              $result = Invoke-WebRequest @params
     |                        ~~~~~~~~~~~~~~~~~~~~~~~~~
     | Response status code does not indicate success: 400 (Bad Request).

Suggested solution to the issue

N/A

Operating System

OsName               : Microsoft Windows 10 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 19041.1.amd64fre.vb_release.191206-1406
OsLanguage           : en-US
OsMuiLanguages       : {en-US}

PowerShell Version

PSVersion                      7.2.6
PSEdition                      Core
GitCommitId                    7.2.6
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module Version

Running: 0.16.1
Installed: 0.16.1
HowardWolosky commented 1 year ago

This is the key thing that sticks out to me from your log:

VERBOSE: Accessing [Get] https://github.mycompany.com/api/v3/users [Timeout = 0)]

Are you intentionally trying to use GitHub Enterprise? If so, are you sure that https://github.mycompany.com/api/v3 is the location of your company's GitHub installation (I'm assuming you've intentionally replaced "mycompany.com" here in these logs)?

Liturgist commented 1 year ago

@HowardWolosky, yes, this is Github Enterprise and I replaced my company name with 'mycompany.com'. Both of these links produce JSON ouptut in a web browser.

https://github.mycompany.com/api/v3
https://github.mycompany.com/api/v3/users
Liturgist commented 1 year ago

For some unknown reason it is working today. I do not know of any changes made that would have been related to this issues. Closing.