Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 internal error when trying to access drive.files.watch #59

Closed
afirstenberg opened this issue Jul 15, 2013 · 3 comments
Closed

500 internal error when trying to access drive.files.watch #59

afirstenberg opened this issue Jul 15, 2013 · 3 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@afirstenberg
Copy link

Using googleapis 0.2.13-alpha. I'm having trouble using this module and trying to call the recently released drive.files.watch endpoint. Other endpoints appear to work correctly, but this one is causing the error. The class is correctly discovered, and called using:

  var subscription = {
    id: "id-1373896667820"
    token: "101852559274654726533",
    type: 'web_hook',
    address: 'https://prisoner.com/dev/glass-drive/incoming/file'
  };
  var params = {
    fileId: '14lITDEjLp-YGZ8tkZGLT19ouAD5rhuDrYDRt-J6o1RE'
  };
  client.drive.files.watch( params, subscription )
  .withAuthClient(user.auth)
  .execute(function(err,data){
    console.log( 'drive.files.watch', err, data, user.auth );
  });

user.auth is a valid object containing the clientId, clientSecret, and credentials containing the access_token and refresh_token.

Adding some debugging to BaseRequest.prototype.execute (request.js, after line 125) I can confirm that the authClient has the correct user.auth information. The requestOpts object is set to

{ method: 'POST',
  uri: 'https://www.googleapis.com/rpc',
  json: 
   [ { jsonrpc: '2.0',
       id: 0,
       method: 'drive.files.watch',
       params: [Object],
       apiVersion: 'v2' } ] }

which appears correct. The params field contains

{ fileId: '14lITDEjLp-YGZ8tkZGLT19ouAD5rhuDrYDRt-J6o1RE',
  resource: 
   { id: 'id-1373896667820',
     token: '101852559274654726533',
     type: 'web_hook',
     address: 'https://prisoner.com/dev/glass-drive/incoming/file' } }

which also appears correct.

The error returned is:

{ code: 500,
  message: 'Internal Error',
  data: 
   [ { domain: 'global',
       reason: 'internalError',
       message: 'Internal Error' } ] }

Using the exact same parameters, and the exact same access_token, I have run the following curl command:

curl \
  --header "Authorization: Bearer valid-access-token-redacted" \
  --header "Content-type: application/json" \
  --data '{"id": "id-1373896667820", "type": "web_hook", "address": "https://pri
soner.com/dev/glass-drive/incoming/file", "token": "101852559274654726533"}' \
  https://www.googleapis.com/drive/v2/files/14lITDEjLp-YGZ8tkZGLT19ouAD5rhuDrYDR
t-J6o1RE/watch

Which works correctly.

@rakyll
Copy link
Contributor

rakyll commented Jul 16, 2013

It's the RPC backend that causes the problem, the RESTful endpoints are fine. Since, node client is one of the few consumers of the RPC, the severity of the problem is low. I'm planning to fix #8 to get rid of the RPC.

@rakyll
Copy link
Contributor

rakyll commented Jul 17, 2013

FYI, this method requires you to set a channel parameter instead of setting body. It's inconstent with the rest of the API, therefore I'm pushing the team to fix it. But, for the short term, you can make the calls in the following format:

client.drive.files.watch({ fileId: '<fileId>', channel: {
     id: 'id-1373896667820',
     token: '101852559274654726533',
     type: 'web_hook',
     address: 'https://prisoner.com/dev/glass-drive/incoming/file'
}}).execute();

@rakyll
Copy link
Contributor

rakyll commented Jul 22, 2013

I'm closing this issue. API backend will fix the problem this week. Temporarily, you can use the workaround I've posted on the prev comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants