Document AI Online Succeeds but Batch Fails with mysterious Code 3

I am testing out prediction requests to the Google Invoice Processor with the Node.js SDK.  When I make prediction requests as an "online request", the process succeeds and I get back a result object to parse.  However, when I submit the exact same document to the same processor as a "batch", the long-running operation fails after approx. 20 seconds with a very generic message:

GoogleError: Failed to process all documents.
    at Operation._unpackResponse ([path]/google-gax/src/longRunningCalls/longrunning.ts:220:23)
    at [path]/google-gax/src/longRunningCalls/longrunning.ts:195:14 {
  code: 3

I have tested with multiple different sample documents, all with the same result: online prediction works but batch prediction fails with this error.

  const [operation] = await client.batchProcessDocuments({
    name: FQ_INV_PROCESSOR_NAME,
    inputDocuments: {
      gcsDocuments: {
        documents: DOCS_FROM_GCS,
      },
    },
    documentOutputConfig: {
      gcsOutputConfig: {
        gcsUri: "gs://<my-bucket>/<prefix>/",
      },
    },
  });

  try {
    const res = await operation.promise();
    console.log("Success result", res); // Never reached
  } catch (err) {
    console.error("Error class:", err); // Prints out the Code 3 "Failed to process all documents" error.
  }

 I've also investigated different API endpoints to query the long-running operation (LRO) details to see if they include any additional debuggable information, but all the ones I tried gave me the same information; nothing additional.

0 2 355
2 REPLIES 2

Hello, have you found a solution ?

I did this way:

client.batchProcessDocuments(request).then(item=>{

console.log(JSON.stringify(item[0]),'\n');
console.log(item[0].latestResponse,'\n');

});