Meteor-Files with AWS


I’m trying to follow these steps:

but the onAfterUpload function is not called. I only see the files locally on my computer.
I see them here:
and this is part of my code:

const UserFiles = new FilesCollection({
		debug: true, // Change to `true` for debugging
		storagePath: 'assets/app/uploads/attachments',
		collectionName: 'userFiles',
		// Disallow Client to execute remove, use the Meteor.method
		allowClientCode: false,

		// Start moving files to AWS:S3
		// after fully received by the Meteor server
	onAfterUpload(fileRef) {

Maybe onBeforeUpload returns false, preventing the call to onAfterUpload?


‘onBeforeUpload’ is also not called : (
and I don’t see the definition of ‘onAfterUpload’ in ‘FilesCollection’. Should it be there?


The Collection is not exported by the module:

const UserFiles = ....

// should be

export const UserFiles = ....

I’m adding “import S3 from ‘aws-sdk/clients/s3’;”
and the app crashes on:
var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0);
Buffer is not defined


sounds like you are trying to execute server side code on the client. add a if (Meteor.isServer) {...} around the new Buffer code.


It’s my code. It’s in the file ‘moduls.js’.


Now onBeforeUpload is called, and I return true;
onAfterUpload is still not called.
I have this on the console:
“[FilesCollection] [UploadInstance] [sendEOF] false”
from core.js