Stephan Mühlstrasser
unread,Sep 3, 2018, 5:48:22 PM9/3/18Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Cloud Developers
I'm indeed testing this from a virtual machine in Google Compute Engine, but I cannot see any environment variable in the shell that could be related to OAuth authentication:
$ printenv | awk -F= '{ print $1 }'
LS_COLORS
SSH_CONNECTION
LANG
EDITOR
SSH_AUTH_SOCK
USER
GOPATH
PWD
HOME
GOROOT
SSH_AGENT_PID
SSH_CLIENT
SSH_TTY
MAIL
TERM
SHELL
SHLVL
LOGNAME
PATH
_
OLDPWD
I also checked the bucket and files permissions, and none of them has the "allUsers" member. I tested again with another small sample application and I even can download files from the bucket without providing the credentials file:
$ cat dlimg.js
const filename = "wc-1534080999.jpg";
const bucketName = "webcamstore";
console.log(process.env.GOOGLE_APPLICATION_CREDENTIALS);
const storage = require('@google-cloud/storage') ({projectId: 'WebCam'});
const bucket = storage.bucket('webcamstore');
const options = {
// The path to which the file should be downloaded, e.g. "./file.txt"
destination: filename,
};
// Downloads the file
storage
.bucket(bucketName)
.file(filename)
.download(options)
.then(() => {
console.log(
`gs://${bucketName}/${filename} downloaded to ${filename}.`
);
})
.catch(err => {
console.error('ERROR:', err);
});
$ node dlimg.js
undefined
gs://webcamstore/wc-1534080999.jpg downloaded to wc-1534080999.jpg.
"undefined" shows that the environment variable GOOGLE_APPLICATION_CREDENTIALS is not set when the program is run.