Using this method
orbiterFilesRemove(id) {
return OrbiterFiles.remove({_id: id});
},
I get an exception:
(node:31887) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
This is the definition of OrbiterFiles
export const OrbiterFiles = new FilesCollection({
storagePath: storagePath,
collectionName: 'orbiter_files',
allowClientCode: false, // Disallow remove files from Client
onBeforeUpload(file) {
// Allow upload files under 10MB, and only in png/jpg/jpeg formats
if(file.size <= 10485760 && /png|jpg|jpeg/i.test(file.extension)) return true;
return 'Please upload image (png or jpg), with size equal or less than 10MB';
},
});
Found the solution.
The object returned by OrbiterFiles.remove() is not a JSONable object.
Meteor try to return it and is stucked in a infinite loop.
Just remove the return statement, and it is fine....
orbiterFilesRemove(id) {
OrbiterFiles.remove({_id: id});
},
or
orbiterFilesRemove(id) {
OrbiterFiles.remove({_id: id});
return 'whatever';
},
Most helpful comment
Found the solution.
The object returned by OrbiterFiles.remove() is not a JSONable object.
Meteor try to return it and is stucked in a infinite loop.
Just remove the return statement, and it is fine....
or