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) ->
rowParser(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?