I'm having trouble getting Iron Router and Spiderable working together nicely in my Meteor.js app. If I test a url with ?_escaped_fragment_=
whilst running on my localhost it all works correctly but as soon as i push to our DigitalOcean production server i keep getting the following error when trying the same thing (check out http://hreglobal.com/?_escaped_fragment_=):
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/dynamics_nodejs.js:9)
at _.extend.get (packages/meteor/dynamics_nodejs.js:21)
at RouteController.lookupOption (packages/iron:router/lib/route_controller.js:66)
at new Controller.extend.constructor (packages/iron:router/lib/route_controller.js:26)
at ctor (packages/iron:core/lib/iron_core.js:88)
at Function.Route.createController (packages/iron:router/lib/route.js:133)
at Function.Router.createController (packages/iron:router/lib/router.js:185)
at Function.Router.dispatch (packages/iron:router/lib/router_server.js:39)
at Object.router (packages/iron:router/lib/router.js:15)
at next (/opt/hre/bundle/programs/server/npm/webapp/node_modules/connect/lib/proto.js:190:15)
Have been trying to find the cause for days now and starting to get a bit desperate. Any pointers welcome!
There are a few causes for this:
When this happens on production but not locally this could mean a package has a minification problem. To test this you can run meteor build --debug which skips minification and deploy. Or you can run locally with meteor run --production which will run it locally with minification. Either way should show you if it's a minification problem.
Another option for production issues but not local issues is a timeout issue with spiderable. It may be worth increasing the timeout to see if that solves the problem. I would try the minification first though.
The third production issue but not local issue has to do with the ROOT_URL being wrong. This is also worth checking quickly. Make sure that the ROOT_URL that your server is configured to use is accessible by the server itself.
If this is happening both locally and on a production server, that can be caused by publish calls that do not properly return ready(). This can be debugged by commenting out subscriptions on the faulty endpoint until you find the faulty publish.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With