Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run waitForOperation.js for operation status #3654

Open
davidanrod opened this issue Nov 8, 2022 · 0 comments
Open

Can't run waitForOperation.js for operation status #3654

davidanrod opened this issue Nov 8, 2022 · 0 comments
Labels
api: compute Issues related to the Compute Engine API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@davidanrod
Copy link

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!

@davidanrod davidanrod added priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Nov 8, 2022
@product-auto-label product-auto-label bot added the api: compute Issues related to the Compute Engine API. label Nov 8, 2022
@sofisl sofisl added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Nov 10, 2022
@sofisl sofisl transferred this issue from googleapis/nodejs-compute Nov 16, 2022
@alexander-fenster alexander-fenster removed their assignment May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: compute Issues related to the Compute Engine API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants