Unable to get GCS contents
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
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?
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.