Thursday, 16 March 2017

"Can't wait without a fiber" error when querying db?

I have the following code that reads a CSV file and then pulls a document from the database:

fs.readFile process.env.PWD + '/data/errorports.csv', 'utf8', (err, data) ->
    if err
      console.log "Error reading csv", err
      return
    rows = data.split('\n')
    for row in rows
      columns = row.split(',')
      airportCode = columns[0]
      airport = Airports.findOne({_id: airportCode})
      console.log 'airport:', airport

But when I call Airports.findOne({_id: airportCode}) it throws the error:

/Users/abemiessler/.meteor/packages/meteor-tool/.1.3.4.19lp8gr++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:159
   throw new Error('Can\'t wait without a fiber');
         ^
Error: Can't wait without a fiber

Can anyone see why I would be getting this error? Any suggestions on how to get around it?



via Abe Miessler

No comments:

Post a Comment