nodejs-dialogflow icon indicating copy to clipboard operation
nodejs-dialogflow copied to clipboard

Long-running operation promise never resolves

Open jdelman opened this issue 7 years ago • 7 comments

Calls to endpoints with long-running operations return an array with an operation object and an API response. You are supposed to be able to call operation.promise() which should resolve when the operation completes. In the scenario where the API response object's done property is set to true (in other words, the operation completed immediately), the promise never resolves.

Environment details

  • OS: Linux
  • Node.js version: 8.16.0
  • npm version: 6.4.1
  • dialogflow version: 0.12.1

Steps to reproduce

The issue may be hard to reproduce because it only seems to happen when the initial api response has done: true.

  1. Perform an importAgent function, i.e. const [op, resp] = agentsClient.importAgent()
  2. Call op.promise().

jdelman avatar Oct 16 '19 17:10 jdelman

Hey @jdelman a few questions for you:

  1. what runtime environment are you running in (Cloud Functions, Kubernetes Engine, App Engine?).
  2. is this happening intermittently, some of the time?

bcoe avatar Oct 16 '19 17:10 bcoe

@bcoe -

  1. Running in a local development environment inside Docker right now.
  2. It does seem to happen intermittently - it seems to depend on the size or complexity of the agent imported, as some agents take longer and therefore do not return done: true with the initial response from importAgent.

jdelman avatar Oct 16 '19 18:10 jdelman

@alexander-fenster any thoughts on this? I haven't played much with long-running operations, any additional debugging information that might be useful.

bcoe avatar Oct 18 '19 19:10 bcoe

@bcoe I reproduced it just by adding a unit test on this condition in google-gax. It's amazing that it's the first time it's reported :) I will fix it today.

alexander-fenster avatar Oct 18 '19 20:10 alexander-fenster

@jdelman I was too fast stating that - it was some other problem that caused that failure for me. It actually works both in my unit test and when I try running the test code with an actual gRPC server returning an actual Operation with done set to true.

I will try reproducing it with dialogflow library and importAgent call as you suggest, and will let you know.

alexander-fenster avatar Oct 18 '19 21:10 alexander-fenster

@alexander-fenster any updates here? Possibly related to #381

callmehiphop avatar Nov 15 '19 14:11 callmehiphop

This issue seems to now be obsolete. Closing this issue. Please, reopen if needed.

b-loved-dreamer avatar Feb 25 '21 20:02 b-loved-dreamer