Hi all,
I’m getting this error when doing a findOne on some mongo collection in a server method.
All these code run fine before. I just upgraded meteor from 1.6.0.1 to 1.10.2.
This is the code that is producing the error:
let moneda = {};
let compania = {};
let suscriptor = {};
let asegurado = null;
result.forEach(cuota => {
// aparently, this findOne produces the error
moneda = Monedas.findOne(cuota.moneda, { fields: { simbolo: 1, descripcion: 1, }});
compania = Companias.findOne(cuota.compania, { fields: { abreviatura : 1, nombre: 1, }});
suscriptor = Suscriptores.findOne(cuota.suscriptor, { fields: { abreviatura : 1 }});
... ...
After the upgrade, everything seemed to work fine, until I checked a little more and found errors on server code that do a findOne on a mongodb collection. From what I can see, although meteor upgraded several packages when upgrading from 1.6 to 1.10, matb33:collection-hooks was not upgraded. It was in version 0.8.1 and is still there.
I mention this because this package is shown in the error message:
Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
at Object.Meteor._nodeCodeMustBeInFiber (packages\meteor.js:1186:11)
at Meteor.EnvironmentVariable.EVp.get (packages\meteor.js:1199:10)
at Object.collection. [as findOne] (packages\matb33_collection-hooks.js:129:37)
at ns.Collection.findOne (packages/mongo/collection.js:356:29)
at server/methods/consultas/consultaCuotasPendientesCobroVencimientos/consultas_MontosPendientesCobro_Vencimientos.js:211:30
Of course I’m not using non meteor code or something similar here. Just normal meteor code and, as I said before, code that run fine for years before the upgrade.
Can somebody shed some light into this and help me solve this issue?
Many thanks and bye …