Meteor.wrapAsync and Bluebird Promise - ExcelJS


I am parsing some excel spreadsheets but no matter how I wrap the calls, I end up with the typical “Meteor code must always run within a fiber” error.

workbook = new (require('exceljs')).Workbook()

uploadPath = "/some/path/to/file.xlsx"

rowParser = (row,number) ->
   # process each row

workbook.xlsx.readFile(uploadPath).then(() ->
    ws = workbook.getWorksheet(1)
    ws.eachRow((row,number) ->

the rowParser function processes each row and inserts the processed data into an array.

The error is thrown inside the rowParser function, apparently resolving the promise isn’t a problem at all.

I’ve been trying to wrap rowParser into Meteor.wrapAsync() but it didn’t work:

rowParser = Meteor.wrapAsync(_rowParser)

(and of course adjusted the function name to _rowParser)

Any ideas?


Does it insert into a collection?

There is an issue with Bluebird and Meteor’s fiber based sync-style coding.


No, it only pushes into a local array and then returns the whole thing to the frontend.
The function is running in Meteor.methods.


Can we see the code for rowParser?