Google-api-ruby-client: [Batch Processing] Google::Apis::ClientError - Invalid request

Created on 22 Jul 2017  路  13Comments  路  Source: googleapis/google-api-ruby-client

Does batch processing API changed recently?

  1. I got 'Invalid request' error.

image

  1. It works fine without batch processing.

image


My batch processing codes worked fine even a few days ago.
Why does that error happen?
I can't figure out what's the problem.

Please help.
Thanks.

All 13 comments

Getting the same issue, my code's worked fine for months, and just stopped working a while ago. Removed the batch and it works.

I checked the ClientError and it says the request was a 404 for some reason.

I get this error when I specify download_dest

gdrive.get_file(file_id)
#<Google::Apis::DriveV3::File:0x00005560d19e91e8 @id="FILE_ID", @kind="drive#file", @mime_type="application/vnd.google-apps.spreadsheet", @name="MY_FILE_NAME>

gdrive.get_file(file_id, download_dest: '/tmp/my_file.xls')
*** Google::Apis::ClientError Exception: Invalid request

it's strange that with other files everything works correctly

I have rights to view and download that file:

SCOPE = Google::Apis::DriveV3::AUTH_DRIVE_READONLY

any ideas? thanks

To resolve need to specific mime_type

gdrive.export_file(file_id, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", download_dest: tempfile.path)

It looks like a member of our great community answered your questions. Thanks @Mifrill! Please add a comment if you have any more questions and we can reopen this issue.

@mattwhisenhunt I don't think @Mifrill's comment had anything to do with the original issue?

@DuBistKomisch are batch requests still coming back 404?

Not sure, been working fine without batching, I'll try it out again this weekend.

I still am getting the Google::Apis::ClientError: Invalid request while specifying download_dest. If I don't specify download_dest, the file gets downloaded but its empty.

Any idea guys ?

I'm having a similar issue with the gmail API

@nduncan-cs130 please try to use correct mime_type, you can compare with those:
https://stackoverflow.com/questions/4212861/what-is-a-correct-mime-type-for-docx-pptx-etc

@Mifrill My issue is a bit different than the first post's issue.
I'm using the Gmail API to batch the requests to fetch information about a list of emails. My code looks like this:

gmail_api.batch do |gmail|
        message_ids.each do |message_id|
          gmail.get_user_message("me", message_id, :format => "metadata")  do 
            [process message...]
          end
        end
      end

I'm non-deterministically getting the error message:
Google::Apis::ClientError - Invalid request

@nduncan-cs130 can you shed some light for this implementation, please?
(what is gmail_api and text_answer) in details

I have exactly the same issue @marine1079 described. When processing requests in a batch and one of them fails the error is returned to all the requests effectively drawing batching requests as a useless thing.
Performing the same requests one be one provides the expected behavior: only one with the wrong ID fails.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MattMencel picture MattMencel  路  3Comments

eric-hu picture eric-hu  路  4Comments

gimite picture gimite  路  3Comments

bekkou68 picture bekkou68  路  3Comments

bootstraponline picture bootstraponline  路  4Comments