Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

Immediate failure when adding simple:json-routes #82

Closed
lspellman opened this issue Jan 15, 2016 · 22 comments
Closed

Immediate failure when adding simple:json-routes #82

lspellman opened this issue Jan 15, 2016 · 22 comments

Comments

@lspellman
Copy link

Tried adding simple:rest to a Meteor 1.2 project. Immediate failure on any of the application's pre-defined urls (using iron:router)

Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.

Appears in client browser and server console, pointing back to ...simple_json-routes/.2.0.0.1im763x++os+web.browser+web.cordova/npm/node_modules/connect-route/lib/connect-route.js:110:5)

Removed simple:rest, working again. Tried adding just simple:json-routes and firing up app, same issue.

@stubailo
Copy link
Owner

Hmm, any chance you could make a reproduction? I've used this package in a variety of apps and haven't seen this issue, perhaps it's specific to iron:router.

@curtislarson
Copy link

Also ran into this issue when using simple:rest in conjunction with iron:router

@lspellman
Copy link
Author

Apologize, I moved on to Restivus and didn't post a repo. I have a private repo that I could add you as a team member if you'd like.

@zuizuihao
Copy link

I encounter the same bug.
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:1)
at [object Object].
.extend.get (packages/meteor/dynamics_nodejs.js:21:1)
at [object Object].RouteController.lookupOption (packages/iron_router/lib/route_controller.js:66:1)
at new Controller.extend.constructor (packages/iron_router/lib/route_controller.js:26:1)
at [object Object].ctor (packages/iron_core/lib/iron_core.js:88:1)
at Function.Router.createController (packages/iron_router/lib/router.js:201:1)
at Function.Router.dispatch (packages/iron_router/lib/router_server.js:39:1)
at Object.router (packages/iron_router/lib/router.js:15:1)
at next (/Users/sampeng/.meteor/packages/webapp/.1.2.3.15kpnst++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:190:15)
at Object.handle (/Users/sampeng/.meteor/packages/simple_json-routes/.2.0.0.a216ze++os+web.browser+web.cordova/npm/node_modules/connect-route/lib/connect-route.js:110:5)

@johanbrook
Copy link

We also got this, but when upgrading to JsonRoutes 2.0.0. I couldn't get to the root cause, so I finally went down the route of eliminating IronRouter from the app completely.

I had the same stack trace as @zuizuihao above – seems like IronRouter is hooking into some global Connect module logic, and getting called as a middleware? (in a next() call or something).

@juho
Copy link

juho commented Feb 24, 2016

+1. 1.0.4 does not have this. Repro: add latest iron:router and nimble:restivus into the same project. Using pre-0.8.6 of nimble:restivus (when they switched to 2.0.1 of simple:json-routes) doesn't have this problem ie. 0.8.5 is fine.

@omidahourai
Copy link

+1 using FlowRouter, getting same issue with Fiber after install. Using Meteor 1.3-beta-8

@namirsab
Copy link

namirsab commented Mar 8, 2016

I'm having the same issue. Iron:router and simple:json-routes are not compatible.

@Obiwarn
Copy link

Obiwarn commented Mar 8, 2016

halp! same error here.

simple:json-routes* upgraded from 1.0.4 to 2.0.1

now i get the same error.

what to do?

@jowilhnson
Copy link

+1 same error immediately upon adding simple:json-routes to 1.2 project with iron-router

@stubailo
Copy link
Owner

Thankfully I got a reproduction of this from the Galaxy team. Simple:rest and json-routes should now be compatible with all other middleware packages for Meteor. Thanks for reporting.

@namirsab
Copy link

@stubailo
I think the issue is not really fixed.
Right now what's happening to me is that every other routes that are not related with the API crash with this error:

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 (meteor://💻app/packages/meteor/dynamics_nodejs.js:9:1)
    at [object Object]._.extend.get (meteor://💻app/packages/meteor/dynamics_nodejs.js:21:1)
    at [object Object].RouteController.lookupOption (meteor://💻app/packages/iron_router/lib/route_controller.js:66:1)
    at new Controller.extend.constructor (meteor://💻app/packages/iron_router/lib/route_controller.js:26:1)
    at [object Object].ctor (meteor://💻app/packages/iron_core/lib/iron_core.js:88:1)
    at Function.Router.createController (meteor://💻app/packages/iron_router/lib/router.js:201:1)
    at Function.Router.dispatch (meteor://💻app/packages/iron_router/lib/router_server.js:39:1)
    at Object.router (meteor://💻app/packages/iron_router/lib/router.js:15:1)
    at next (/home/sab/.meteor/packages/webapp/.1.2.2.ykx08b++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:190:15)
    at Object.handle (/home/sab/.meteor/packages/simple_json-routes/.2.0.1.xb5z5z++os+web.browser+web.cordova/npm/node_modules/connect-route/lib/connect-route.js:110:5)
    at Object.next (/home/sab/.meteor/packages/webapp/.1.2.2.ykx08b++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:190:15)
    at Object.immediate._onImmediate (timers.js:381:16)
    at processImmediate [as _immediateCallback] (timers.js:363:15)

I'm using nimble:restivus by the way.

@stubailo
Copy link
Owner

@namirsab interesting, have you upgraded to the newest versions?

@namirsab
Copy link

Yes i used the latest restivus package. Before this issue was fixed i couldn't even use it, but after that I can use it but the problem I mention happens.

@stubailo
Copy link
Owner

@namirsab can you give me the contents of the .meteor/versions file in your app?

@namirsab
Copy link

Sorry it was not possible for me to give you the .meteor/versions file. Which packages are you interested in?

@stubailo
Copy link
Owner

Anything involved in server-side routing - middlewares, iron router, restivus, etc.

Alternatively, if you could set up a reproduction that would be super helpful. But it's hard to know what's going on exactly without a way to get it to happen on my machine.

@namirsab
Copy link

Okey, I will try to set up a repro with just a few package.
I'm not using any middleware, just restivus and iron:router
I updated restivus to latest after this ticket was closed, and then the API was working, but not other urls.
I've downgraded again and now everything works.

@gdaunton
Copy link

gdaunton commented Apr 1, 2016

I am also getting the same error when trying to register a new user with the rest-accounts-password package. I have no other simple: packages installed other than the ones that are required.

@stubailo
Copy link
Owner

stubailo commented Apr 1, 2016

Still looking for a reproduction!

@gdaunton
Copy link

gdaunton commented Apr 2, 2016

@zeroasterisk
Copy link

I'm getting this as well, with Meteor v1.4.1 --- it seems to be reproducable by submitting poorly formed JSON, somehow missing the JSON error handler and causing beef with Fiber

W20160822-14:27:50.392(-4)? (STDERR) Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
W20160822-14:27:50.392(-4)? (STDERR)     at Object.Meteor._nodeCodeMustBeInFiber (packages/meteor/dynamics_nodejs.js:9:1)
W20160822-14:27:50.393(-4)? (STDERR)     at Object.Meteor.bindEnvironment (packages/meteor/dynamics_nodejs.js:85:1)
W20160822-14:27:50.393(-4)? (STDERR)     at Object.handle (packages/simple_json-routes/json-routes.js:46:1)
W20160822-14:27:50.393(-4)? (STDERR)     at next (/Users/alan/.meteor/packages/webapp/.1.3.11.1lq9pmi++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:169:17)
W20160822-14:27:50.393(-4)? (STDERR)     at next (/Users/alan/.meteor/packages/webapp/.1.3.11.1lq9pmi++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:149:78)
W20160822-14:27:50.393(-4)? (STDERR)     at next (/Users/alan/.meteor/packages/webapp/.1.3.11.1lq9pmi++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:149:78)
W20160822-14:27:50.393(-4)? (STDERR)     at next (/Users/alan/.meteor/packages/webapp/.1.3.11.1lq9pmi++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:171:11)
W20160822-14:27:50.394(-4)? (STDERR)     at next (/Users/alan/.meteor/packages/webapp/.1.3.11.1lq9pmi++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:171:11)
W20160822-14:27:50.394(-4)? (STDERR)     at next (/Users/alan/.meteor/packages/webapp/.1.3.11.1lq9pmi++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:171:11)
W20160822-14:27:50.394(-4)? (STDERR)     at /Users/alan/.meteor/packages/simple_json-routes/.2.1.0.9ba585++os+web.browser+web.cordova/npm/node_modules/connect/node_modules/body-parser/lib/read.js:117:7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests