You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On making a request without base64 encoding, getting the below error:
**An error occurred when inspecting the object: #<ArgumentError: invalid byte sequence in UTF-8>
Result of Kernel#inspect: #<Google::Cloud::DocumentAI::V1::ProcessResponse:0x0000000128b78670 @descriptor=#<Google::Protobuf::Descriptor:0x0000000125b89ec8>>**
On making a request with base64 encoding, getting the below error:
If you're using the client libraries in https://cloud.google.com/document-ai/docs/process-documents-client-libraries then you should not be doing any base64 encoding. The error you're getting without base64 encoding suggests to me that the request actually did succeed. The error is actually happening when trying to pretty-print the response. It looks like there's a field somewhere in the response message that is a binary string but is being incorrectly marked as utf-8, which if true might indicate a bug in the protobuf library. As a workaround, I suggest, instead of printing or inspecting the response, just get the fields you're interested in.
Thank you so much for taking time to go through my issue. I actually went ahead with a nodejs client library. It works perfectly with base64 encoding and according to the documentation.
Sharing little more details about the problem however when I used ruby.
I am not inspecting or printing from my part as such, even though the error message somehow suggests that. I also believe that there is some bug in the protobuf library just as you pointed it out.
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.
But 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:
On making a request with base64 encoding, getting the below error:
bin_file = File.binread file_path
content = Base64.strict_encode64(bin_file)
The text was updated successfully, but these errors were encountered: