Meteor-Community-Packages / Meteor-CollectionFS

Reactive file manager for Meteor
MIT License
1.05k stars 237 forks source link

File have 0 byte size after upload #599

Open fajarsuhendra opened 9 years ago

fajarsuhendra commented 9 years ago

I just install collectionFS and follow the tutorial to get the feels of collectionFS. I can upload the file, return the _id, but the url doesn't show up. When I check the console, everytime I start hitting submit button, and carefully watch the terminal, this guy show up

I20150310-09:24:13.232(7)? Exception in queued task: TypeError: Cannot read property 'start' of undefined
I20150310-09:24:13.233(7)?     at Object.FS.StorageAdapter.createReadStream (packages/cfs:gridfs/gridfs.server.js:78:1)
I20150310-09:24:13.233(7)?     at Object.self.adapter.createReadStreamForFileKey (packages/cfs:storage-adapter/storageAdapter.server.js:71:1)
I20150310-09:24:13.233(7)?     at Object.self.adapter.createReadStream (packages/cfs:storage-adapter/storageAdapter.server.js:79:1)
I20150310-09:24:13.233(7)?     at packages/cfs:tempstore/tempStore.js:364:1
I20150310-09:24:13.233(7)?     at runWithEnvironment (packages/meteor/dynamics_nodejs.js:108:1)
I20150310-09:24:13.233(7)?     at packages/meteor/dynamics_nodejs.js:121:1
I20150310-09:24:13.233(7)?     at CombinedStream._getNext (/home/.meteor/packages/cfs_tempstore/.0.1.4.uge6wi++os+web.browser+web.cordova/npm/node_modules/combined-stream/lib/combined_stream.js:83:3)
I20150310-09:24:13.233(7)?     at CombinedStream.resume (/home/.meteor/packages/cfs_tempstore/.0.1.4.uge6wi++os+web.browser+web.cordova/npm/node_modules/combined-stream/lib/combined_stream.js:132:10)
I20150310-09:24:13.233(7)?     at CombinedStream.pipe (/home/.meteor/packages/cfs_tempstore/.0.1.4.uge6wi++os+web.browser+web.cordova/npm/node_modules/combined-stream/lib/combined_stream.js:64:8)
I20150310-09:24:13.233(7)?     at saveCopy (packages/cfs:worker/fileWorker.js:176:1)

I can see that the file is uploaded, but the size is 0. Two storage adapter got the same error as above, they are filesystem and gridfs. Did I do it wrong? or this is an ongoing process

aaronjudd commented 9 years ago

See #588

fajarsuhendra commented 9 years ago

I try the gridfs 0.0.31 but it still did not work (maybe I implemented it wrong)

Now, I use the gridfs 0.0.27 and it works. I think I will stick into it for while

Thanks aaronjudd

vectorselector commented 7 years ago

This shouldn't be closed.

I've got filesystem & gridfs both, and originally moved OFF gridfs to filesystem to get to the bottom of this same problem (zero kb files after upload. Now it appears that it's CollectionFS related, rather than storage adaptor?

(aka, about the specific version of gridfs, i've already been through hell and back with 0.33 being the only one that works in production...I have files now and i see files with 0kb, so unless it's a temporary store issue (gridfs still?) the issue transcends the particular storage adapter.

I know this package is deprecated, but keeping issues like this open is crucial for forensic analysis etc.

Now, how to get OFF CollectionFS now that my entire app is based around the api of accessing files as collection documents lol

vectorselector commented 7 years ago

so, what I am experiencing: to be clear: an image appears to upload ok, but actually it's not ok, when everything worked prior and no versions had been changed since gridfs 0.33 problem appeared after about 2000 images of about 150kb uploaded, went from intermittent to rather constant with gridfs. about a week back, I added cfs:filesystem adapter and mounted (via S3FS) a Minio (open source S3 clone) to a local folder and added a method for an admin function to pipe the readstream to the writestream, with both storage adapters backing each Collection, as an array. This worked fine, and I managed to completely export all images to files and things work fine.

Except that this issue appeared again suddenly...

upload looks ok: a search of the cardImages.filerecord collection shows:

{ "cardImages-fs": { "name": "B83_inside copy.jpg", "type": "image/jpeg", "size": 210413, "key": "cardImages-GL2gFoLePPnNnhCZG-B83_inside copy.jpg", "updatedAt": "2017-06-25T21:02:55.388Z", "createdAt": "2017-06-25T21:02:55.388Z" }, "cardImages": { "name": "B83_inside copy.jpg", "type": "image/jpeg", "size": 210413, "key": "595024ffb33c1129369684b3", "updatedAt": "2017-06-25T21:02:55.456Z", "createdAt": "2017-06-25T21:02:55.456Z" } }

that's ok, like 200k... correct. previously, the error was that the cardImages.files entry would have a size of 0kb and there would literally be NO chunk files with the associated key. Now, with cfs:filesystem storage adapter, the cardImages.files entry shows the correct size, but i see an empty image file:

-rw-r--r-- 1 someone somegroup 0 Jun 25 21:02 cardImages-GL2gFoLePPnNnhCZG-B83_inside copy.jpg

so, I'm trying to figure out what happens in between and where the ball gets dropped...