GoogleCloudPlatform / google-cloud-powershell

PowerShell cmdlets for the Google Cloud Platform
http://googlecloudplatform.github.io/google-cloud-powershell/
Apache License 2.0
135 stars 61 forks source link

Get-GceMetadata fails with 403 on subsequent runs (works the first time) #607

Closed Coleeb closed 6 years ago

Coleeb commented 6 years ago

At some point between release 177.0.0 and 193.0.0 (latest) of the gCloud SDK, this cmdlet no longer works after a single invocation.

To reproduce:

On a Windows VM, open Powershell and run:

Get-GceMetadata

It should return the top level metadata categories. Re-run the same command and you should see the same output as before, but instead there is an unformatted 403 error. Get-GceMetadata will work again (1 time) in a new Powershell window.

Here's an example output:

PS C:\Users\bob> Get-GceMetadata instance/ oslogin/ project/

PS C:\Users\bob> Get-GceMetadata <!DOCTYPE html>

Error 403 (Forbidden)!!1

403. That’s an error.

Your client does not have permission to get URL /computeMetadata/v1/? from this server. Missing Metada ta-Flavor:Google header. That’s all we know.

quoctruong commented 6 years ago

@Coleeb Thanks for reporting the issue. Do you know which version of the module you are using? (You can see this with Get-Module GoogleCloud command when the module is loaded).

Coleeb commented 6 years ago

1.0.1.6 on the instance where this is currently reproducible.

Thanks for looking into this!

quoctruong commented 6 years ago

@Coleeb This is now fixed in version 1.0.1.7. Please give it a try!