nodejs-docs-samples
nodejs-docs-samples copied to clipboard
[@google-cloud/storage] imageFile.download no longer works
"@google-cloud/storage": "^7.7.0",
This code has been working for 4+ years without change. And now all of a sudden it doesn't work.
Very simple example
const imageFile = await storage.bucket(env.gcloudCloudStorage).file(fileUpload.fileLocation);
// Options from the client
const tempLocalPath = `${tmpdir}/${fileId}`;
// Check that the file exists
const exists = await imageFile.exists();
if (!exists[0]) {
const exists = await imageFile.exists();
if (!exists[0]) {
throw returnError('file-not-found-on-cloud', 'File not found');
}
}
// Create the temp file
// ERROR HERE
// await imageFile.download({ destination: tempLocalPath });
await imageFile.makePublic();
const fileUrl = getFileLink(imageFile);
await downloadFile(fileUrl, tempLocalPath);
The line await imageFile.download({ destination: tempLocalPath });
fails with
TypeError: Cannot read properties of null (reading 'length')
at getStateLength (/Users/superbadwolf/Projects/my-app/nine_pm_node/node_modules/stream-shift/index.js:16:28)
at shift (/Users/superbadwolf/Projects/my-app/nine_pm_node/node_modules/stream-shift/index.js:6:99)
at Duplexify._forward (/Users/superbadwolf/Projects/my-app/nine_pm_node/node_modules/duplexify/index.js:170:35)
at PassThrough.onreadable (/Users/superbadwolf/Projects/my-app/nine_pm_node/node_modules/duplexify/index.js:136:10)
at PassThrough.emit (node:events:519:28)
at emitReadable_ (node:internal/streams/readable:832:12)
at processTicksAndRejections (node:internal/process/task_queues:81:21)
My resolution for now was making it public and downloading manually, this works..
await imageFile.makePublic();
const fileUrl = getFileLink(imageFile);
await downloadFile(fileUrl, tempLocalPath);
I'm using .createReadStream()
and getting the same error
"@google-cloud/storage": "7.7.0",
Can't event catch it with try/catch or .on('error'...
it's crashing whole application.
@danielduhh for yoru awareness, an issue on storage samples.
@ollyde Apologies in the delay in responding to your issue here.
This issue queue is for handling issues associated with the samples that exist in this repository. This looks like you are reporting an issue with the API potentially or the service itself and sharing your code. I appreciate knowing that there might be some change that was unexpected (are you still experiencing this problem?)
We can't provide assistance on issues that are not associated with samples in this repository. If you have a support contract with Google, please create an issue in the support console.
@iennae I abandoned Google Cloud Platform last year, there are hundreds of bugs & features missing I reported over 2 years, not a single one has been fixed.
And no wonder; when you ignore simple requests like this, it's extremely poor support, I will never be going back, and it seems like Google Cloud is losing customers everyday.
The support console is a joke, never had a reply from it, literally hundreds of tickets.
This is an issue with THIS library, you have marked as completed. Disgraceful.