jalik / ufs-demo

Example project that uses UploadFS.
2 stars 3 forks source link

Won't upload, getting error messages like: "ufs: cannot write file "hgjW94Y8LbXeThPfX" (ENOENT, open '/uploads/files/hgjW94Y8LbXeThPfX.jpg')" #1

Closed JulianKingman closed 8 years ago

JulianKingman commented 8 years ago

I set this up locally and ran it, I'm getting the following when it tries to add/upload files:

W20160726-21:48:02.229(-4)? (STDERR) ufs: cannot write file "hgjW94Y8LbXeThPfX" (ENOENT, open '/uploads/files/hgjW94Y8LbXeThPfX.jpg')
W20160726-21:48:02.249(-4)? (STDERR) ufs: cannot delete temp file /tmp/ufs/hgjW94Y8LbXeThPfX (ENOENT, unlink '/tmp/ufs/hgjW94Y8LbXeThPfX')
I20160726-21:48:02.251(-4)? Exception while invoking method 'ufsComplete' Error: ENOENT, open '/uploads/files/hgjW94Y8LbXeThPfX.jpg'
I20160726-21:48:02.252(-4)?     at Object.Future.wait (/Users/Julian/.meteor/packages/meteor-tool/.1.3.5_1.7r58ss++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:449:15)
I20160726-21:48:02.252(-4)?     at [object Object].Meteor.methods.ufsComplete (packages/jalik_ufs/ufs-methods.js:52:1)
I20160726-21:48:02.252(-4)?     at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1711:12)
I20160726-21:48:02.253(-4)?     at packages/ddp-server/livedata_server.js:711:19
I20160726-21:48:02.253(-4)?     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20160726-21:48:02.253(-4)?     at packages/ddp-server/livedata_server.js:709:40
I20160726-21:48:02.254(-4)?     at [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)
I20160726-21:48:02.254(-4)?     at packages/ddp-server/livedata_server.js:707:46
I20160726-21:48:02.255(-4)?     at tryCallTwo (/Users/Julian/.meteor/packages/promise/.0.7.3.83b80d++os+web.browser+web.cordova/npm/node_modules/promise/lib/core.js:45:5)
I20160726-21:48:02.255(-4)?     at doResolve (/Users/Julian/.meteor/packages/promise/.0.7.3.83b80d++os+web.browser+web.cordova/npm/node_modules/promise/lib/core.js:200:13)
I20160726-21:48:02.255(-4)?     - - - - -
jalik commented 8 years ago

Hi @JulianKingman, you need to check that your app has the permissions to write in the mentioned path (/uploads and /tmp/ufs).

  1. First create destination directory : sudo mkdir /uploads
  2. Be sure that directory is owned by the app user, if the user running meteor is julian do this : sudo chown -R julian /uploads
  3. Finally set permissions : sudo chmod -R 755 /uploads;
JulianKingman commented 8 years ago

Hmm. Well, that didn't exactly work for some reason, but running sudo meteor worked just fine. Is this necessary in production as well, or just because it's local?

jalik commented 8 years ago

@JulianKingman, you must never run meteor with sudo (root privileges), this means that your app can write everywhere or delete any file of your Operating System.

The fact that running your app with sudo worked confirms that it's a matter of permissions, you should check again that everything is fine.

Maybe you could change the path of the local store ? /uploads is the default path, but you can set /home/julian/uploads if you want.

PhotosStore = new UploadFS.store.Local({
    collection: Photos,
    name: 'photos',
    path: '/home/julian/photos'
});
JulianKingman commented 8 years ago

That didn't seem to make a difference. I verified the permissions, they're 755 and owned by me (Julian).

If you simply copy this repo to your local machine and run it, does it work for you?

jalik commented 8 years ago

I am sorry @JulianKingman, everything is fine on my side, this project (UFS-Example) is my sandbox for the UploadFS package, so yes I test it everytime I add a new feature or fix something in UFS. It's working as intended, I deleted everything and then executed the following commands : sudo mkdir /uploads sudo chown -R karl:root /uploads sudo chmod -R 775 /uploads

After I started the app and could transfer files without any kind of problem.. I don't know how I can help You but I am pretty sure it has nothing to do with the package since if your app has the permission to write it will write, if not, then you get the error above (the one you had).