Skip to content

Error: Body attribute missing in multipart #139

Description

@sridharAJ

i am using drive version2 to insert a new file to google-drive.
To insert a new file to a google drive using client.files.insert() function

i am getting the following error:

Error: Body attribute missing in multipart.

var auth = new googleapis.OAuth2Client();

auth.setCredentials({
  access_token: 'accesskey'
});

googleapis.discover('drive', 'v2').execute(function(err, client) {
      client.drive.files.insert({ title: 'Test', mimeType: 'application/json' })
    .withMedia('application/json', "Hello world")
    .withAuthClient(auth)
    .execute(function(error,result){
      if(error){
        console.log(error);
      }else{
        console.log(result);
      }
    });

what is problem 20days back the above code is worked for me.but now its not.
is there any update happened in gopogleapis module or requestjs?

Activity

  1. sridharAJ commented on Feb 25, 2014

    @sridharAJ
    Author

    the above error is comes when the automatic refresh the access_token option is enable.
    when the time of making request one more time the problem is occurs....
    so if the access_token is not expired the its working fine...

    pls fix this bug...

  2. axelhzf commented on Jun 10, 2014

    @axelhzf

    I'm having the same problem.

    My temporal fix is to call auth.refreshAccessToken manually before the insert call.

  3. sridharAJ commented on Jul 1, 2014

    @sridharAJ
    Author

    yeah i also did the same thing...

  4. ryanseys commented on Jul 31, 2014

    @ryanseys
    Contributor

    Just released 1.0.3 which addresses this issue. The access token will be refreshed prior to initial request if has expired or is missing and you have a refresh token set. If the request fails due to a missing, invalid, or revoked access token, we will no longer attempt to refresh and re-attempt the request, which is why you're seeing this issue.

    https://github.com/google/google-api-nodejs-client/releases/tag/1.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

🚨This issue needs some love.triage meI really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions