nodejs-storage: CONTENT_DOWNLOAD_MISMATCH
Hey, not sure if the bug is in regards to this package. Please close, if its not.
I ran
gsutil -m setmeta -r -h "Cache-control:public, max-age=259200" gs://ari-motors-2-uploads
and get the following error when downloading the images through @google-cloud/storage
:
strapi_1 | RequestError: The downloaded data did not match the data from the server. To be sure the content is the same, you should download the file again.
strapi_1 | at PassThrough.onComplete (/srv/app/node_modules/@google-cloud/storage/build/src/file.js:1044:43)
strapi_1 | at processTicksAndRejections (internal/process/task_queues.js:95:5) {
strapi_1 | code: 'CONTENT_DOWNLOAD_MISMATCH'
strapi_1 | }
The file is later passed to sharp, which throw this error:
strapi_1 | [Error: Input buffer contains unsupported image format]
image download code:
const options = {
destination: destFilename,
};
try {
await storage.bucket(bucketName).file(filepath).download(options);
} catch (error) {
console.log(error);
The exact same code did work before executing the command. The command didn’t cause an error when running it the first time about two months ago.
Example file (public url): https://storage.googleapis.com/ari-motors-2-uploads/05_ARI_145_Seitenansicht_vorn_rechts_00b43df2d0/05_ARI_145_Seitenansicht_vorn_rechts_00b43df2d0.jpg
The downloaded files are safed as images with storage objects as content:
{
"kind": "storage#object",
"id": "ari-motors-2-uploads/ARI_458_Pritsche_L_Titelbilder_ef3149077f/ARI_458_Pritsche_L_Titelbilder_ef3149077f.png/1628772205883389",
"selfLink": "https://www.googleapis.com/storage/v1/b/ari-motors-2-uploads/o/ARI_458_Pritsche_L_Titelbilder_ef3149077f%2FARI_458_Pritsche_L_Titelbilder_ef3149077f.png",
"mediaLink": "https://storage.googleapis.com/download/storage/v1/b/ari-motors-2-uploads/o/ARI_458_Pritsche_L_Titelbilder_ef3149077f%2FARI_458_Pritsche_L_Titelbilder_ef3149077f.png?generation=1628772205883389&alt=media",
"name": "ARI_458_Pritsche_L_Titelbilder_ef3149077f/ARI_458_Pritsche_L_Titelbilder_ef3149077f.png",
"bucket": "ari-motors-2-uploads",
"generation": "1628772205883389",
"metageneration": "3",
"contentType": "image/png",
"storageClass": "STANDARD",
"size": "607105",
"md5Hash": "y+ng2GK1Oh03UNcXQuxi8g==",
"contentDisposition": "inline; filename=\"ARI 458 Pritsche LTitelbilder.png\"",
"cacheControl": "public, max-age=259200",
"crc32c": "H1fSVw==",
"etag": "CP3fgabBq/ICEAM=",
"timeCreated": "2021-08-12T12:43:25.885Z",
"updated": "2021-09-21T07:22:12.574Z",
"timeStorageClassUpdated": "2021-08-12T12:43:25.885Z"
}
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 15
Also getting failure as of this morning when using file upload from stream. Even the Google example itself (https://cloud.google.com/storage/docs/streaming#storage-stream-upload-object-nodejs) is not working.
I get the error: { “message”: “Required”, “domain”: “global”, “reason”: “required” }
Btw, some old code, non updated project still works, using version 5.1.1. However, pulling this same version fresh still doesn’t work