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

Object reference not set to an instance of an object - Get-Gceinstance on project with no VMs #649

Open TitanRob16 opened 3 years ago

TitanRob16 commented 3 years ago

This seems to have stopped working for my entire team overnight (it was working fine yesterday). When running Get-gceinstance -Project [projectname] against a project without any VM instances, we receive the error:

Get-gceinstance : Object reference not set to an instance of an object.
At line:1 char:1
+ Get-gceinstance -Project [projectname]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-GceInstance], NullReferenceException
    + FullyQualifiedErrorId : System.NullReferenceException,Google.PowerShell.ComputeEngine.GetGceInstanceCmdlet

The command works fine when there are instances within the project. I've tried uninstalling and reinstalling the PowerShell module, and I've tried reinstalling the Cloud SDK to no avail. I expect the command to give nothing rather than an error message.

Any help with this would be greatly appreciated.