CollectionFS S3 setup problems


#1

I am having troubles making the CollectionFS S3 to work.

I have followed the indications on how to setup the S3 bucket as in here: https://atmospherejs.com/cfs/s3

Assuming that the S3 bucket is properly set up. This is the error I am getting from the browser console:

Error: "Queue" failed [503] Error in method "/cfs/files/:value/:value/", Error: Error: FS.TempStore.Storage is not set: Install cfs:filesystem or cfs:gridfs or set it manually at mount... [undefined], Error: failed [503] Error in method "/cfs/files/:value/:value/", Error: Error: FS.TempStore.Storage is not set: Install cfs:filesystem or cfs:gridfs or set it manually at mount... [undefined] at cfs_upload-http.js:351 at cfs_upload-http.js:77 at underscore.js:750 at XMLHttpRequest.xhr.onreadystatechange (cfs_upload-http.js:200)

This is the collectionFS and S3 configuration in the meteor project. It is located in the /lib folder (so both in the client and the server).

var models3DStore = new FS.Store.S3("models3D", {
 region: "eu-west-1", //optional in most cases
 accessKeyId: "XXXXX", //required if environment variables are not set
 secretAccessKey: "XXXXXX", //required if environment variables are not set
 bucket: "testXXXXXX", //required
 maxTries: 5
});

Models3D = new FS.Collection('models3D', {
 stores: [models3DStore]
});

Any ideas?


#2

How the S3 adapter works is:

File is uploaded to the server with a temporary storage adapter, this could be on the filesystem (a folder on the server) or grids (in the db). When it’s complete the server uploads the file to S3. Once this is done the temporary file is removed.

The problem you’re having is that you haven’t defined installed an adapter for temporary stores. So firstly install cfs:filesystem or cfs:grids. Read the installation section of the docs:

Here’s a snippet to configure the tempstore as the filesystem, but I’m pretty sure this is optional and it should work by simply installing on of the temp store adapters:

FS.TempStore.Storage = new FS.Store.FileSystem("_tempstore", {
    internal :  true,
    path : '/app-storage/tmp',
});

#3

@nlammertyn this was exactly the problem. I have just added the GridFS package and it worked straight away.

As you said the code snippet is optional.

Thanks


#4

Another little gotcha to watch out for with this is when you deploy, make sure you have your permissions set correctly for whatever the folder is that the temp uploads get stored in. This happened to me. And it manifests as a weird error you’ll only see when you deploy if the user that’s running your Meteor doesn’t have permission to create and/or add to the temp store folder on the server.

If this happens, you’ll know because uploading won’t work and you’ll get an error in the console.