Meteor-Community-Packages / Meteor-CollectionFS

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

File upload fails with cfs-ejson-file in .meteor/packages #255

Closed ghost closed 10 years ago

ghost commented 10 years ago

I need the package because I want to store a reference to a FS.File in my object.

Minimal code that reproduces the error: https://github.com/Sanjo/collectionFS_test/tree/cfs-filesystem-and-ejson-file

Client Error Log:

PUT to URL /cfs/files/eventPhotos/rwDPwLBGAprcLNXPp Object {filename: "facebook_logo.png"} upload-http-client.js:18
PUT http://localhost:3000/cfs/files/eventPhotos/rwDPwLBGAprcLNXPp?chunk=0&filename=facebook_logo.png 404 (Not Found) http-call-client.js:198
Error: "Queue" failed [404] Not Found [404] [undefined], Error
    at http://localhost:3000/packages/cfs-upload-http.js?2353aee6577f52571ddbced3b04c21b95468e1ec:404:16
    at http://localhost:3000/packages/cfs-upload-http.js?2353aee6577f52571ddbced3b04c21b95468e1ec:110:7
    at _.once (http://localhost:3000/packages/underscore.js?0a80a8623e1b40b5df5a05582f288ddd586eaa18:801:19)
    at XMLHttpRequest.xhr.onreadystatechange (http://localhost:3000/packages/cfs-upload-http.js?2353aee6577f52571ddbced3b04c21b95468e1ec:233:11) power-queue.js:478
uploading chunk 0, bytes 0 to 11124 of 11124 

Server log:

I20140404-20:48:58.676(2)? Error in oplog callback Error: insert found for already-existing ID in published
I20140404-20:48:58.680(2)?     at _.extend._handleOplogEntrySteadyOrFetching (packages/mongo-livedata/oplog_observe_driver.js:502)
I20140404-20:48:58.682(2)?     at packages/mongo-livedata/oplog_observe_driver.js:118
I20140404-20:48:58.683(2)?     at packages/mongo-livedata/oplog_observe_driver.js:16
I20140404-20:48:58.683(2)?     at Object.Meteor._noYieldsAllowed (packages/meteor/fiber_helpers.js:15)
I20140404-20:48:58.683(2)?     at packages/mongo-livedata/oplog_observe_driver.js:106
I20140404-20:48:58.684(2)?     at packages/mongo-livedata/oplog_tailing.js:79
I20140404-20:48:58.684(2)?     at runWithEnvironment (packages/meteor/dynamics_nodejs.js:89)
I20140404-20:48:58.684(2)?     at packages/meteor/dynamics_nodejs.js:102
I20140404-20:48:58.684(2)?     at packages/livedata/crossbar.js:68
I20140404-20:48:58.684(2)?     at Function._.each._.forEach (packages/underscore/underscore.js:113)
I20140404-20:48:58.685(2)? Exception in queued task: Error: Unknown id for changed: undefined
I20140404-20:48:58.685(2)?     at self.applyChange.changed (packages/minimongo/observe.js:65)
I20140404-20:48:58.685(2)?     at packages/mongo-livedata/observe_multiplex.js:159
I20140404-20:48:58.685(2)?     at Array.forEach (native)
I20140404-20:48:58.685(2)?     at Function._.each._.forEach (packages/underscore/underscore.js:105)
I20140404-20:48:58.685(2)?     at Object.task (packages/mongo-livedata/observe_multiplex.js:153)
I20140404-20:48:58.686(2)?     at _.extend._run (packages/meteor/fiber_helpers.js:150)
I20140404-20:48:58.686(2)?     at packages/meteor/fiber_helpers.js:128
I20140404-20:48:58.689(2)? FileWorker CHANGED - calling saveCopy eventPhotos for undefined
I20140404-20:48:58.689(2)? saving to store eventPhotos
I20140404-20:48:58.689(2)? createWriteStream eventPhotos, internal: undefined
I20140404-20:48:58.692(2)? -----------FINISH STREAM eventPhotos
I20140404-20:48:58.696(2)? SA FileSystem - DONE!! fileKey: "eventPhotos-undefined-undefined"
I20140404-20:48:58.760(2)? -----------STORED STREAM eventPhotos
I20140404-20:48:58.761(2)? SA eventPhotos stored eventPhotos-undefined-undefined
I20140404-20:48:58.761(2)? UPDATE: {"$set":{"copies.eventPhotos":{"size":0,"key":"eventPhotos-undefined-undefined","updatedAt":"2014-04-04T18:48:58.000Z","createdAt":"2014-04-04T18:48:58.000Z"}}}
I20140404-20:48:58.762(2)? -----------CLOSE STREAM eventPhotos
ghost commented 10 years ago

I found out that the files are stored in the file collection 'cfs.eventPhotos.filerecord' like so: { "EJSON$type" : "FS.File", "EJSON$value" : { "EJSON_id" : "Mgp96BwtGLKPLFpSh", "EJSONcollectionName" : null }, "_id" : ObjectId("533f09e23bb5843159f50e7a") }

and https://github.com/CollectionFS/Meteor-cfs-access-point/blob/master/access-point-server.js#L90 fails to find the file.

aldeed commented 10 years ago

There is at least one Meteor issue involved as I'm trying to figure this out. See meteor/meteor#2018.

There might be something else going on as well, but it's hard to get past the Meteor issue to find out.

raix commented 10 years ago

Why is the collectionName null? Is it not mounted?

aldeed commented 10 years ago

This was an issue with our cloning function. It should be fixed now.