google-cloud-node icon indicating copy to clipboard operation
google-cloud-node copied to clipboard

Deadline Exceeded (30s) for Vertex AI Image Generation Predict Endpoint / Need Configurable Setting

Open praveentcom opened this issue 1 year ago • 3 comments

Please make sure you have searched for information in the following guides.

  • [X] Search the issues already opened: https://github.com/GoogleCloudPlatform/google-cloud-node/issues
  • [X] Check our Troubleshooting guide: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/troubleshooting
  • [X] Check our FAQ: https://googlecloudplatform.github.io/google-cloud-node/#/docs/guides/faq
  • [X] Check our libraries HOW-TO: https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md
  • [X] Check out our authentication guide: https://github.com/googleapis/google-auth-library-nodejs
  • [X] Check out handwritten samples for many of our APIs: https://github.com/GoogleCloudPlatform/nodejs-docs-samples

Documentation Request

Deadline Exceeded (30s) for Vertex AI Image Generation Predict Endpoint / Need Configurable Setting

Error: 4 DEADLINE_EXCEEDED: Deadline exceeded after 30.000s,name resolution: 0.270s,metadata filters: 0.001s,LB pick: 0.269s

Client - PredictionServiceClient from @google-cloud/aiplatform.

const client = new PredictionServiceClient({
  apiEndpoint: _model.model_base_url,
  credentials: json_key,
  projectId: `${json_key.project_id}`,
});

const endpoint = `projects/${json_key.project_id}/locations/us-central1/publishers/google/models/imagegeneration@006`;
const instance = helpers.toValue({
  prompt: transformedRequest.prompt
});
const parameters = helpers.toValue({
  sampleCount: transformedRequest.n,
  aspectRatio: transformedRequest.aspectRatio,
  includeRaiReason: true,
  includeSafetyAttributes: true,
  safetySetting: "block_few",
  outputOptions: {
    mimeType: "image/png"
  }
});

const response = await client.predict({
  endpoint,
  instances: !_.isNil(instance) ? [instance] : [],
  parameters
});

DEADLINE_EXCEEDED error

The gRPC call times out after 30 seconds. I am not sure if this is a hard limitation set by Vertex AI or if it's a client limitation. What's the best way to proceed forward here?

praveentcom avatar Jun 02 '24 10:06 praveentcom

cc @ddelgrosso1

praveentcom avatar Jun 06 '24 12:06 praveentcom

Facing same issue

manusis avatar Jun 22 '24 08:06 manusis

Could you try increasing the timeout, described in CallOptions?

sofisl avatar Jul 18 '24 16:07 sofisl

This has been closed since a request for information has not been answered for 15 days. It can be reopened when the requested information is provided.

github-actions[bot] avatar Sep 20 '24 19:09 github-actions[bot]

add timeout in ms to predict CallOptions:

const response = await client.predict({
  endpoint,
  instances: !_.isNil(instance) ? [instance] : [],
  parameters
}, {
  timeout: 60000,
});

sakaljurgis avatar Mar 21 '25 11:03 sakaljurgis