googleapis / googleapis/google-cloud-ruby

Facing difficult in sending a request to document ai processor

Open
#25,951 2 comments 0 reactions 1 assignee Claimed by @aandreassa View on GitHub
Dominant language
Ruby
Stars
1.4k
Forks
578
Avg merge
1d 11h
Merged PRs (30d)
166

Description

[https://cloud.google.com/document-ai/docs/process-documents-client-libraries](https://cloud.google.com/document-ai/docs/process-documents-client-libraries) following this documentation on making a request to individual document processing.

According to the below screenshot, we need to send a base64 encoded image.
Screenshot 2024-05-24 at 2 50 44 PM

But [https://cloud.google.com/document-ai/docs/process-documents-client-libraries](https://cloud.google.com/document-ai/docs/process-documents-client-libraries) suggests without encoding approach.

`content = File.binread file_path`

### Both approaches:

On making a request without base64 encoding, getting the below error:

**An error occurred when inspecting the object: #
Result of Kernel#inspect: #>**

On making a request with base64 encoding, getting the below error:

`bin_file = File.binread file_path`
`content = Base64.strict_encode64(bin_file)`

**3:Invalid image content. debug_error_string:{UNKNOWN:Error received from peer ipv6:%5B2404:6800:4007:81e::200a%5D:443 {created_time:"2024-05-24T14:54:57.103571+05:30", grpc_status:3, grpc_message:"Invalid image content"}} (Google::Cloud::InvalidArgumentError)**

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.