Hi community,
I’m working on a Google Cloud Function that processes invoices using Document AI. The function is triggered by a file upload to a Cloud Storage bucket. However, when testing locally and deploying, I run into this error:
AttributeError: 'NoneType' object has no attribute 'X'
Here’s what I’ve confirmed so far:
- The Cloud Function is correctly triggered on file upload.
- Document AI processor ID, project ID, and location are defined using environment variables.
- I’m using
documentai.DocumentProcessorServiceClient().process_document(...)as per the official Python SDK.
The processor exists in the EU region, and I’ve double-checked the processor_path() and request structure. Despite this, it seems that the result.document is coming back as None, or possibly result itself is None.
Has anyone encountered this before when integrating Document AI with Cloud Functions? What are common causes for NoneType responses here?
Any help or direction is greatly appreciated ![]()