UPDATE:
Two changes to my application code were able to resolve this problem for me.
-
I purged my database models, eliminating all previous collections that were created from CFS:s3 under different settings and drivers.
-
I changed the policy rules on my s3 bucket to allow public reads
Fortunately I was in a place where both of these were acceptable during development, and a public-read bucket is acceptable for prod, so it works out… for me. Best wishes to anyone who encounters this problem in the future.
/client/client_models/images.js
var imagesStore = new FS.Store.S3("handstack-test", { bucket: "handstack-test"});
Images = new FS.Collection("images", {
stores: [imagesStore],
filter: {
allow: {
contentTypes: ['image/*']
}
}
});
/server/lib/server_models/images.js
var imagesStore = new FS.Store.S3("handstack-test", {
accessKeyId: Meteor.settings.private.aws.key,
secretAccessKey: Meteor.settings.private.aws.secret,
bucket: "handstack-test",
region: "us-east-1" /**,
beforeWrite: function(fileObj) {
fileObj.size(64, {store: "imagesStore", save: false});
},
transformWrite: function(fileObj, readStream, writeStream) {
gm(readStream, fileObj.name()).resize('64', '64').stream().pipe(writeStream)
}*/
});
Images = new FS.Collection("images", {
stores: [imagesStore],
filter: {
allow: {
contentTypes: ['image/*']
}
}
});
Images.allow({
insert: function () {
return true;
},
update: function () {
return true;
},
remove: function () {
return true;
},
download: function(){
return true;
}
});
Making the following call on the client
Images.insert(image, callback);
Results in the following websocket traffic being sent:
["{\"msg\":\"method\",\"method\":\"/cfs.AWSImages.filerecord/update\",\"params\":[{\"_id\":\"YuP9PbuGAtD2mheiK\"},{\"$set\":{\"chunkSize\":2097152,\"chunkCount\":0,\"chunkSum\":1}},{}],\"id\":\"3\"}"] 200
10:27:36.529
["{\"msg\":\"method\",\"method\":\"/cfs.AWSImages.filerecord/update\",\"params\":[{\"_id\":\"YuP9PbuGAtD2mheiK\"},{\"$push\":{\"userIds\":\"BuHRXBWmwQN6PTrp9\"}},{}],\"id\":\"4\"}"] 181
10:27:36.555
a["{\"msg\":\"result\",\"id\":\"3\",\"result\":1}"] 51
10:27:36.599
a["{\"msg\":\"updated\",\"methods\":[\"3\"]}"] 46
10:27:36.606
a["{\"msg\":\"result\",\"id\":\"4\",\"result\":1}"] 51
10:27:36.648
a["{\"msg\":\"updated\",\"methods\":[\"4\"]}"] 46
10:27:36.737
h 1
10:27:41.513
a["{\"msg\":\"ping\"}"] 23
10:27:56.567
["{\"msg\":\"pong\"}"]
And will save the image to s3, but not to my Images collection.
It will save properly to CFS’s ‘cfs.images.filerecord’ collection.
And here are the packages I’m using:
# Meteor packages used by this project, one per line.
# Check this file (and the other files in this directory) into your repository.
#
# 'meteor add' and 'meteor remove' will edit this file for you,
# but you can also edit it by hand.
meteor-base # Packages every Meteor app needs to have
mobile-experience # Packages for a great mobile UX
mongo # The database Meteor supports right now
session # Client-side reactive dictionary for your app
jquery # Helpful client-side library
tracker # Meteor's client-side reactive programming library
standard-minifiers # JS/CSS minifiers run for production mode
es5-shim # ECMAScript 5 compatibility for older browsers.
angular@1.3.1
angularui:angular-ui-router
accounts-password
angularutils:pagination
tmeasday:publish-counts
check
email
fourseven:scss
driftyco:ionic
civilframe:angular-jade
reywood:publish-composite
momentjs:moment
jasonaibrahim:angular-moment
digilord:faker
aldeed:collection2
http
cfs:standard-packages
cfs:gridfs
danialfarid:ng-file-upload
alexk111:ng-img-crop
vitalets:angular-xeditable
mikowals:batch-insert
deanius:promise
sebastianilves:angular-chart-js
meteorhacks:npm
meteorhacks:picker
npm-container
angularui:angular-google-maps
cfs:s3
cfs:graphicsmagick