question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

(node:133220) UnhandledPromiseRejectionWarning: Error: [object Object] at Gaxios.<anonymous> …at Generator.next (<anonymous>)

See original GitHub issue

Environment details

  • OS: Windows 10
  • Node.js version: v10.14.1
  • npm version: 6.4.1
  • googleapis version: 38

Steps to reproduce

  1. node .\download.js 1Z9c119EzgR4Dd5Woi-C34Xl6Qu_87FugdlwwYRJhzlE

This code produces following error:

writing to C:\Users\ASHOT_~1\AppData\Local\Temp\a9b522b9-0582-4dc3-b73c-0b9593892ff3
(node:143084) UnhandledPromiseRejectionWarning: Error: [object Object]
    at Gaxios.<anonymous> (C:\Users\Ashot_Minasyan\Downloads\google-api-nodejs-client-master\google-api-nodejs-client-master\node_modules\gaxios\build\src\gaxios.js:72:27)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\Ashot_Minasyan\Downloads\google-api-nodejs-client-master\google-api-nodejs-client-master\node_modules\gaxios\build\src\gaxios.js:16:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:143084) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without
a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:143084) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Running quickstart.js works ok so authentication is not a problem I think. Here is stackoverflow question https://stackoverflow.com/questions/55326387/node133220-unhandledpromiserejectionwarning-error-object-object-at-gaxios

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
NetajiBandicommented, Jun 28, 2019

I was just able to reproduce this bug and fix it as well.

I was mistaken by thinking that the issue is having alt: ‘media’ under params of drive.files.get But for me issue turned out to be an insufficient permissions.

I was using the token.json file which got saved before all the needed scopes were defined. I initially had only below two scopes,

['https://www.googleapis.com/auth/drive.metadata',
'https://www.googleapis.com/auth/drive.metadata.readonly']

But after adding all the required scopes (required for download) as below,

const SCOPES = [
  'https://www.googleapis.com/auth/drive',
  'https://www.googleapis.com/auth/drive.appdata',
  'https://www.googleapis.com/auth/drive.file',
  'https://www.googleapis.com/auth/drive.metadata',
  'https://www.googleapis.com/auth/drive.metadata.readonly',
  'https://www.googleapis.com/auth/drive.photos.readonly',
  'https://www.googleapis.com/auth/drive.readonly',
];

And deleted the old token.json file. This created a new token.json file, and then the download started working.

0reactions
JustinBeckwithcommented, Jun 10, 2019

Greetings! We haven’t seen any action on this issue for a while, so we’re going to go ahead and close it out. If this is still a problem… please do let us know!

Read more comments on GitHub >

github_iconTop Results From Across the Web

UnhandledPromiseRejectionWar...
UnhandledPromiseRejectionWarning : Error: Not Found at Gaxios.<anonymous> when trying to add event to Google Calendar.
Read more >
Async Generators and Async Iteration in Node.js
An object implements the the iterator protocol when it has a next method, and that next method returns an object with a value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found