microsoft / PowerShellForGitHub

Microsoft PowerShell wrapper for GitHub API
Other
588 stars 185 forks source link

Couldn't download asset #337

Closed fleed closed 3 years ago

fleed commented 3 years ago

Issue Details

Trying to use the Get-GitHubReleaseAsset cmdlet, but receiving an error.

Steps to reproduce the issue

Get-GitHubReleaseAsset -OwnerName $ownerName -repositoryname $repositoryName -Asset $assetId -Path $path -AccessToken $token

Verbose logs showing the problem

VERBOSE: [0.16.0] Executing: Get-GitHubReleaseAsset -OwnerName "<redacted>" -RepositoryName "<redacted>" -Asset 43559XXX -Path "/Users/myuser/Documents/data" -AccessToken <redacted> -Verbose:$true
VERBOSE: Downloading release asset 43559XXX
VERBOSE: Accessing [Get] https://api.github.com/repos/<redacted>/<redacted>/releases/assets/43559XXX[Timeout = 0)]
VERBOSE: GET https://api.github.com/repos/<redacted>/<redacted>/releases/assets/43559XXX with 0-byte payload
VERBOSE: received -byte response of content type application/xml
VERBOSE: [0.16.0] Executing: Set-TelemetryException -ErrorBucket "Get-GitHubReleaseAsset"
VERBOSE: Sending telemetry event data to https://dc.services.visualstudio.com/v2/track [Timeout = 0)]
VERBOSE: POST https://dc.services.visualstudio.com/v2/track with 1530-byte payload
VERBOSE: received 49-byte response of content type application/json
Invoke-WebRequest: /Users/myuser/.local/share/powershell/Modules/PowerShellForGitHub/0.16.0/GitHubCore.ps1:301
Line |
 301 |              $result = Invoke-WebRequest @params
     |                        ~~~~~~~~~~~~~~~~~~~~~~~~~
     |  AccessDeniedRequest has expired3002021-09-13T12:07:15Z2021-09-13T12:07:18ZYQVN5GA11B79DV95cfDqWMhV8jJq3MbX3mQGQy+tLy5C0oB8/AUJ82otDrSlhF1f75ZwdN0++cJVUWyLSrtU8p0jZjs=

Operating System

Name Value


OSVersion Unix 11.0.0 Is 64-bit True Current culture Current UI culture

(MacOS 11.5.2)

PowerShell Version

Name Value


PSVersion 7.1.4 PSEdition Core GitCommitId 7.1.4 OS Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 Platform Unix 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.0 Installed: 0.16.0

HowardWolosky commented 3 years ago

Hmmmm... I think I need more info to go on. The tests for that are currently passing fine, and this simple repro works consistently:

$assets = Get-GitHubRepository -OwnerName PowerShell -RepositoryName PowerShell |
                      Get-GitHubRelease -Latest |
                      Get-GitHubReleaseAsset

$assets[0] | Get-GitHubReleaseAsset -Path "~\downloads\data"

As far as I can tell with your report, it's an issue that is local to either that asset or your token. The failure is happening with the web request, and you're getting back AccessDenied Request has expired. Is the failure consistent for you? Does my example above succeed for you?

fleed commented 3 years ago

Thank you @HowardWolosky I tested it again and it worked, maybe it was a temp issue.

Will close it and reopen it if it happens again