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

Unable to get GCS contents #286

Open
rky0930 opened this issue Apr 20, 2020 · 2 comments
Open

Unable to get GCS contents #286

rky0930 opened this issue Apr 20, 2020 · 2 comments

Comments

@rky0930
Copy link

rky0930 commented Apr 20, 2020

Hi, I tried use commuter with GCS backend

I configured all enviroment variables below
COMMUTER_STORAGE_BACKEND=gcs
COMMUTER_BUCKET=<MY_BUCKET>
COMMUTER_PORT=<4006>
GOOGLE_APPLICATION_CREDENTIALS=<MY_SECRET.json>

I got following error when i tried to get list of contents in my GCS bucket.

2020-04-20T17:59:54.69557274Z (node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'prefixes' of undefined
2020-04-20T17:59:54.69559936Z     at cb (/usr/local/share/.config/yarn/global/node_modules/@nteract/commuter/lib/content-providers/gcs/gcs.js:82:15)
2020-04-20T17:59:54.69560896Z     at /usr/local/share/.config/yarn/global/node_modules/@google-cloud/storage/build/src/bucket.js:1408:17
2020-04-20T17:59:54.695617227Z     at onAuthenticated (/usr/local/share/.config/yarn/global/node_modules/@google-cloud/common/build/src/util.js:351:25)
2020-04-20T17:59:54.695625704Z     at /usr/local/share/.config/yarn/global/node_modules/@google-cloud/common/build/src/util.js:381:21
2020-04-20T17:59:54.695633587Z     at processTicksAndRejections (internal/process/task_queues.js:97:5)
2020-04-20T17:59:54.695641457Z (node:1) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 34)

my commuter version is

# npm show @nteract/commuter  version
5.10.0

Thanks

@captainsafia
Copy link
Member

It looks like the error occurs here. We should update the if-statement to check if res existts.

if (res && res.prefixes) {...}

Would you be interested in submitting a contribution with this change?

@aia
Copy link

aia commented Oct 18, 2023

I run into this issue too. The solution is to set GOOGLE_CLOUD_PROJECT environment variable. GCP Node library requires GOOGLE_CLOUD_PROJECT and authentication is failing without it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants