Search code examples
meteormeteor-up

Meteor - Error storing uploaded file to TempStore


I am having issue on uploading the files to my FS Collection.

When first launched with MUP I had no issues. Now I am getting an error in mup logs saying:

Error: Error storing uploaded file to TempStore: EACCES, open '/opt/kpinsonstairs-deploy/cfs/files/_tempstore/images-8r5w8T5cuknAE3SS4-0.chunk'
    at EventEmitter.<anonymous> (packages/cfs_collection/packages/cfs_collection.js:161:1)
    at EventEmitter.emit (events.js:98:17)
    at WriteStream.<anonymous> (packages/cfs_tempstore/packages/cfs_tempstore.js:343:1)
    at WriteStream.emit (events.js:117:20)
    at WriteStream.<anonymous> (fs.js:1669:12)
    at Object.oncomplete (fs.js:108:15)
error: Forever detected script exited with code: 8
error: Script restart attempt #1

I have read how this could be a permission issue with my FS Collection images.

However, I have open permissions for uploading to this collection's path.

Images = new FS.Collection("images", {
  stores: [
    new FS.Store.FileSystem("images", {path: Meteor.absolutePath + '/private/uploads'})
  ],
  filter: {
    maxSize: 2097152, // 2MB
    allow: {
      contentTypes: ['image/*']
    }
  },
  onInvalid: function (message) {
    if (Meteor.isClient) {
      alert(message);
    } else {
      console.log('error: ' + message);
    }
  }
});

if (Meteor.isServer) {
  Images.allow({
    insert: function () {
      return true;
    },
    remove: function () {
      return true;
    },
    download: function () {
      return true;
    },
    update: function () {
      return true;
    }
  });

  Meteor.publish('images', function() {
    return Images.find({});
  });
}

I have not been able to find an answer on how to solve this issue.

How can I solve this issue?


Solution

  • So 'EACCES' is indicative of a file system level permission issue.

    "However, I have open permissions for uploading to this collection's path" -- i'm not sure if this means that you have already checked filesystem permissions -- but that is what you need to do: Check the permissions on the directory /opt/kpinsonstairs-deploy/cfs/files/ and make sure that the user that you are using for running your software has read/write/execute permission to that directory.