Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling operations.get in gcp throws "field [name] has issue [invalid operation name]"

Recently I was trying to get the status of an operation calling operation.get on API explorer in GCP https://cloud.google.com/resource-manager/reference/rest/v1/operations/get

The request throws: field [name] has issue [invalid operation name]

I tried the same request using node Lib for GCP and got the same result.

Operation name used is in format as below: operations/operation-1552901443197-5845b0ae4997f-496bcbdb-xxxxxx

Did someone encounter this error before?

like image 553
Kristi Keri Avatar asked Mar 18 '19 09:03

Kristi Keri


1 Answers

The issue is caused because the operation you are trying to fetch is from a different resource from the API that you are calling.

Most Cloud APIs have their own APIs, and each one performs its own operations under their own resource.

In this case you are trying to get your operation in the Resource Manager API, as a Resource Management resource, while it is from the Compute Engine resource, and this API (or this one if the operation is global to your project) should be used instead. Using this API instead would solve this issue.

I agree that the response message could be improved in order to point users to which is the actual issue, when facing issues like the one in this question.

That's why I have opened a feature request that you can see in the following link. You can star it in order to give it more visibility and notifications on the updates made there, and add comments here if you have any additional information you might add to this improvement.

like image 181
Joan Grau Noël Avatar answered Nov 15 '22 03:11

Joan Grau Noël