GoogleCloudPlatform/node-red-contrib-google-cloud

documentai - "Error: 3 INVALID_ARGUMENT: due to apiEndpoint not defined in service client

lelesrc opened this issue · 0 comments

Environment details

  • OS: ubuntu 22.04
  • Node.js version: 20.9.0
  • npm version: 10.2.3
  • google-cloud-node version: 0.0.26

Steps to reproduce

When using a documentai node, the following error is returned:
message: "Error: 3 INVALID_ARGUMENT: Request contains an invalid argument."

Workaround

Define apiEndpoint in file documentai.js:191

189             documentProcessorServiceClient = new DocumentProcessorServiceClient({
190                 "credentials": credentials,
191                 "apiEndpoint": "eu-documentai.googleapis.com"
192             });

Fix

apiEndpoint could be inferred from location (eu/us) or set by the user in node config.endPoint (more future-proof).