googleapis / googleapis/google-cloud-node
Can't run waitForOperation.js for operation status
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
#### Environment details
- OS:
- Node.js version: 14.17.3
- npm version: 8.15.0
- `@google-cloud/compute` version: 3.5.1
#### Steps to reproduce
1
```
const compute = require('@google-cloud/compute');
// Parse stringified operation to the object instance.
let operation = {
"kind": "sql#operation",
"targetLink": "***",
"status": "PENDING",
"user": "***",
"insertTime": "2022-11-08T16:24:59.158Z",
"operationType": "IMPORT",
"importContext": {},
"name": "84992d7e-07ed-4edd-b6fb-0e2200000024",
"targetId": "****",
"selfLink": "****",
"targetProject": "****"
};
async function waitForOperation() {
const operationsClient = new compute.ZoneOperationsClient();
console.log(operationsClient);
while (operation.status !== 'DONE') {
[operation] = await operationsClient.wait({
operation: operation.name,
project: operation.targetProject,
});
}
console.log('Operation finished.');
}
waitForOperation();
```
GOT
```
(node:44643) UnhandledPromiseRejectionWarning: Error: Cannot build HTTP request for {"operation":"84992d7e-07ed-4edd-b6fb-0e2200000024","project":"***"}, method: Wait
at encodeRequest (....)
```
the operation name and project are correct. i haven't the zone specified on the payload since it's not returned by operations response object.. forcing the value of "europe-west1" has no results too.. Are this lib updated?
Sorry, if i'm missing something obvious..
Thanks!
Contributor guide
Assessment
This issue has not been assessed yet.