Hi,
I noticed an issue when using @google-cloud/storage 1.6.0, that doesn't exist in 1.5.2.
I'm using Google Cloud Functions with getSignedUrl to upload files into storage. I was getting this error:
{ SigningError: Failure from metadata server.
at /user_code/node_modules/@google-cloud/storage/src/file.js:1715:16
at getCredentials (/user_code/node_modules/@google-cloud/storage/node_modules/google-auto-auth/index.js:264:9)
at googleAuthClient.getCredentials (/user_code/node_modules/@google-cloud/storage/node_modules/google-auto-auth/index.js:148:11)
at process._tickDomainCallback (internal/process/next_tick.js:135:7) message: 'Failure from metadata server.' }
When I downgrade to 1.5.2, the issue goes away.
My index.js looks like this:
const storage = require('@google-cloud/storage')();
exports.getSignedUrl = (req, res) => {
if(req.method === 'POST') {
// Perform any authorization checks here to assert
// that the end user is authorized to upload.
const myBucket = storage.bucket('my-bucket-name');
const myFile = myBucket.file(req.body.filename);
const contentType = req.body.contentType;
// This link should only last 5 minutes
const expiresAtMs = Date.now() + 300000;
const config = {
action: 'write',
expires: expiresAtMs,
contentType: contentType
};
myFile.getSignedUrl(config, function(err, url) {
if (err) {
console.error(err);
res.status(500).end();
return;
}
res.send(url);
});
} else {
res.status(405).end();
}
}
My package.json looks like this:
{
"name": "sample-http",
"version": "0.0.1",
"dependencies": {
"@google-cloud/storage": "1.5.2"
}
}
After finding out that 1.5.2 works, I did not look further into this. I'm not sure if this was intentional, or if something in GCF needs to get updated. I'm opening this issue in case this is an unknown bug, and to let others know of a workaround.
https://serverfault.com/q/901144/460159
Hi,
I noticed an issue when using
@google-cloud/storage1.6.0, that doesn't exist in 1.5.2.I'm using Google Cloud Functions with
getSignedUrlto upload files into storage. I was getting this error:When I downgrade to 1.5.2, the issue goes away.
My index.js looks like this:
My package.json looks like this:
After finding out that 1.5.2 works, I did not look further into this. I'm not sure if this was intentional, or if something in GCF needs to get updated. I'm opening this issue in case this is an unknown bug, and to let others know of a workaround.
https://serverfault.com/q/901144/460159