veliovgroup / Meteor-Files

🚀 Upload files via DDP or HTTP to ☄️ Meteor server FS, AWS, GridFS, DropBox or Google Drive. Fast, secure and robust.
https://packosphere.com/ostrio/files
BSD 3-Clause "New" or "Revised" License
1.11k stars 166 forks source link

[FilesCollection.ServiceFile] Path "/assets/app/uploads/ServiceFileCollection" is not writable! #866

Closed ujjwalrg closed 1 year ago

ujjwalrg commented 1 year ago

I've reopened this issue as it was previously opened in issue#223. I followed the instructions there but wasn't able to resolve it.

For my production app, I manually changed the permission of the directory to make it work but I need to be able to set the configuration on the FilesCollection for CI.

Below is the error "W20230219-18:19:24.667(0)? (STDERR) reason: '[FilesCollection.ServiceFile] Path "/assets/app/uploads/ServiceFileCollection" is not writable!', W20230219-18:19:24.667(0)? (STDERR) details: Error: EACCES: permission denied, mkdir '/assets/app/uploads/ServiceFileCollection' W20230219-18:19:24.668(0)? (STDERR) at Object.mkdirSync (fs.js:1014:3) W20230219-18:19:24.668(0)? (STDERR) at new FilesCollection (packages/ostrio:files/server.js:350:10) W20230219-18:19:24.668(0)? (STDERR) at module (imports/api/service/ServiceFiles.js:10:31) W20230219-18:19:24.669(0)? (STDERR) at fileEvaluate (packages/modules-runtime.js:336:7) W20230219-18:19:24.669(0)? (STDERR) at Module.require (packages/modules-runtime.js:238:14) W20230219-18:19:24.669(0)? (STDERR) at Module.moduleLink [as link] (/home/runner/.meteor/packages/modules/.0.18.0.j1mso2.mw1a++os+web.browser+web.browser.legacy+web.cordova/npm/node_modules/@meteorjs/reify/lib/runtime/index.js:52:22) W20230219-18:19:24.669(0)? (STDERR) at module (server/main.js:1:276) W20230219-18:19:24.669(0)? (STDERR) at fileEvaluate (packages/modules-runtime.js:336:7) W20230219-18:19:24.669(0)? (STDERR) at Module.require (packages/modules-runtime.js:238:14) W20230219-18:19:24.669(0)? (STDERR) at require (packages/modules-runtime.js:258:21) W20230219-18:19:24.669(0)? (STDERR) at /tmp/meteor-test-runlvnqsp.rlri8/.meteor/local/build/programs/server/app/app.js:4255:1 W20230219-18:19:24.669(0)? (STDERR) at /tmp/meteor-test-runlvnqsp.rlri8/.meteor/local/build/programs/server/boot.js:401:38 W20230219-18:19:24.669(0)? (STDERR) at Array.forEach () W20230219-18:19:24.670(0)? (STDERR) at /tmp/meteor-test-runlvnqsp.rlri8/.meteor/local/build/programs/server/boot.js:226:21 W20230219-18:19:24.670(0)? (STDERR) at /tmp/meteor-test-runlvnqsp.rlri8/.meteor/local/build/programs/server/boot.js:464:7 W20230219-18:19:24.670(0)? (STDERR) at Function.run (/tmp/meteor-test-runlvnqsp.rlri8/.meteor/local/build/programs/server/profile.js:280:14) { W20230219-18:19:24.670(0)? (STDERR) errno: -13, W20230219-18:19:24.670(0)? (STDERR) syscall: 'mkdir', W20230219-18:19:24.670(0)? (STDERR) code: 'EACCES', W20230219-18:19:24.670(0)? (STDERR) path: '/assets/app/uploads/ServiceFileCollection' W20230219-18:19:24.670(0)? (STDERR) }, W20230219-18:19:24.670(0)? (STDERR) errorType: 'Meteor.Error'"

Below is the config: "const ServiceFileCollection = new FilesCollection({ schema: mySchema, storagePath: '/assets/app/uploads/ServiceFileCollection', // downloadRoute: '/files/ServiceFile', collectionName: 'ServiceFile', // // permissions: 0o774, // parentDirPermissions: 0o774, // permissions: 0o755, permissions: 0o774, parentDirPermissions: 0o774, allowClientCode: false, cacheControl: 'public, max-age=31536000', // Read more about cacheControl: https://devcenter.heroku.com/articles/increasing-application-performance-with-http-cache-headers onbeforeunloadMessage() { console.log( 'Upload is still in progress! Upload will be aborted if you leave this page!' );"

I'm using Meteor 2.7.3.

Note: Even if I try permissions: 0o777 and parentDirPermissions: 0o777, it does not work.

dr-dimitru commented 1 year ago

Hello @ujjwalrg,

Couple of options

  1. Create directory and make it writable as part of CI instructions before the launch of Meteor app
  2. Use default (e.g. void 0) value when running in CI environment

Perhaps you have solved it on your own?

ujjwalrg commented 1 year ago

Ok, thanks. I'll try that. Just wanted to make sure there isn't anything wrong with my configs.