{"action":"created","issue":{"url":"https://api.github.com/repos/kadirahq/flow-router/issues/205","labels_url":"https://api.github.com/repos/kadirahq/flow-router/issues/205/labels{/name}","comments_url":"https://api.github.com/repos/kadirahq/flow-router/issues/205/comments","events_url":"https://api.github.com/repos/kadirahq/flow-router/issues/205/events","html_url":"https://github.com/kadirahq/flow-router/issues/205","id":94553632,"number":205,"title":"flow-router-ssr : call server method in route action from server : cannot find data in collection if not subscribed","user":{"login":"fabien-h","id":2682701,"avatar_url":"https://avatars.githubusercontent.com/u/2682701?v=3","gravatar_id":"","url":"https://api.github.com/users/fabien-h","html_url":"https://github.com/fabien-h","followers_url":"https://api.github.com/users/fabien-h/followers","following_url":"https://api.github.com/users/fabien-h/following{/other_user}","gists_url":"https://api.github.com/users/fabien-h/gists{/gist_id}","starred_url":"https://api.github.com/users/fabien-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabien-h/subscriptions","organizations_url":"https://api.github.com/users/fabien-h/orgs","repos_url":"https://api.github.com/users/fabien-h/repos","events_url":"https://api.github.com/users/fabien-h/events{/privacy}","received_events_url":"https://api.github.com/users/fabien-h/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/kadirahq/flow-router/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/kadirahq/flow-router/labels/v3.0","name":"v3.0","color":"ededed"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-07-12T10:24:00Z","updated_at":"2015-08-17T10:00:34Z","closed_at":null,"body":"There are some collections that I do not wish to publish (like `Meteor.users`, or internal stats) and some datas I want to get in straight json and not as cursors (for pagination purpose mostly). So I want to get them from a `Meteor.call`. No subscription and no reactivity.\r\n\r\nIt works client side, but not server side.\r\n\r\nTo reproduce, clone the repo of the hello react meteor application : https://github.com/arunoda/hello-react-meteor. Then in the router.jsx, change that code :\r\n\r\n    action: function() {\r\n      ReactLayout.render(BlogLayout, {\r\n        content: <PostList />\r\n      });\r\n    }\r\n\r\nTo that one :\r\n\r\n    action: function() {\r\n      Meteor.call('getPost', function (err, res) {\r\n        console.log('err : ', err);\r\n        console.log('res : ', res);\r\n        ReactLayout.render(BlogLayout, {\r\n          content: <PostList />\r\n        });\r\n      });\r\n    }\r\n\r\nAnd add the method to retrieve a post :\r\n\r\n     if( Meteor.server )\r\n        Meteor.methods({\r\n          getPost(){\r\n            return Posts.findOne();\r\n          }\r\n        });\r\n\r\nYou can now find the retrieved post in the client and server console. It works.\r\n\r\nBut now, comment the subscription :\r\n\r\n    //this.register('posts', Meteor.subscribe('posts', selector));\r\n\r\nClient side, it keeps working, but server side, the result is now undefined (the view is broken now of course, but we don't care for this example).\r\n\r\nIs it a bug ? Is it supposed to work that way ? Is there a workaround ?\r\n\r\nHere are the stack traces :\r\n\r\nCall from server :\r\n\r\n\tTrace: undefined\r\n\tat [object Object].Meteor.methods.getPost (both/router.jsx:14:19)\r\n\tat maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1617:1)\r\n\tat packages/ddp/livedata_server.js:1530:1\r\n\tat [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)\r\n\tat [object Object]._.extend.apply (packages/ddp/livedata_server.js:1529:1)\r\n\tat [object Object]._.extend.call (packages/ddp/livedata_server.js:1472:1)\r\n\tat FlowRouter.route.action (both/router.jsx:25:12)\r\n\tat packages/meteorhacks:flow-router-ssr/server/route.js:19:1\r\n\tat [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)\r\n\tat packages/meteorhacks:flow-router-ssr/server/route.js:13:1\r\n\tat doCall (packages/meteorhacks:picker/lib/implementation.js:98:1)\r\n\r\nCall from client\r\n\r\n\tTrace: one\r\n\tat [object Object].Meteor.methods.getPost (both/router.jsx:13:19)\r\n\tat maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1617:1)\r\n\tat packages/ddp/livedata_server.js:648:1\r\n\tat [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)\r\n\tat packages/ddp/livedata_server.js:647:1\r\n\tat [object Object]._.extend.withValue (packages/meteor/dynamics_nodejs.js:56:1)\r\n\tat [object Object]._.extend.protocol_handlers.method (packages/ddp/livedata_server.js:646:1)\r\n\tat packages/ddp/livedata_server.js:546:1\r\n\r\nFrom what I understand, this is a context matter. But I have no idea how to solve that."},"comment":{"url":"https://api.github.com/repos/kadirahq/flow-router/issues/comments/131761318","html_url":"https://github.com/kadirahq/flow-router/issues/205#issuecomment-131761318","issue_url":"https://api.github.com/repos/kadirahq/flow-router/issues/205","id":131761318,"user":{"login":"fabien-h","id":2682701,"avatar_url":"https://avatars.githubusercontent.com/u/2682701?v=3","gravatar_id":"","url":"https://api.github.com/users/fabien-h","html_url":"https://github.com/fabien-h","followers_url":"https://api.github.com/users/fabien-h/followers","following_url":"https://api.github.com/users/fabien-h/following{/other_user}","gists_url":"https://api.github.com/users/fabien-h/gists{/gist_id}","starred_url":"https://api.github.com/users/fabien-h/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fabien-h/subscriptions","organizations_url":"https://api.github.com/users/fabien-h/orgs","repos_url":"https://api.github.com/users/fabien-h/repos","events_url":"https://api.github.com/users/fabien-h/events{/privacy}","received_events_url":"https://api.github.com/users/fabien-h/received_events","type":"User","site_admin":false},"created_at":"2015-08-17T10:00:34Z","updated_at":"2015-08-17T10:00:34Z","body":"Well, now it's broken with a big and scarry error message :\r\n\r\n\txception in delivering result of invoking 'getNumber': Error: Can't call yield in a noYieldsAllowed block!\r\n\tI20150817-11:58:52.452(2)?     at Function.Fiber.yield (packages/meteor/fiber_helpers.js:8:1)\r\n\tI20150817-11:58:52.453(2)?     at Function.wait (/Users/fabienhuet/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:183:14)\r\n\tI20150817-11:58:52.453(2)?     at Object.Future.wait (/Users/fabienhuet/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:397:10)\r\n\tI20150817-11:58:52.453(2)?     at [object Object]._.extend._nextObject (packages/mongo/mongo_driver.js:929:1)\r\n\tI20150817-11:58:52.453(2)?     at [object Object]._.extend.forEach (packages/mongo/mongo_driver.js:963:1)\r\n\tI20150817-11:58:52.453(2)?     at [object Object]._.extend.map (packages/mongo/mongo_driver.js:973:1)\r\n\tI20150817-11:58:52.453(2)?     at [object Object]._.extend.fetch (packages/mongo/mongo_driver.js:997:1)\r\n\tI20150817-11:58:52.453(2)?     at [object Object].Cursor.(anonymous function) [as fetch] (packages/mongo/mongo_driver.js:812:1)\r\n\tI20150817-11:58:52.453(2)?     at [object Object].React.createClass.getMeteorData (both/components/post_list.jsx:8:53)\r\n\tI20150817-11:58:52.454(2)?     at packages/react-meteor-data/meteor-data-mixin.jsx:73:28\r\n\tW20150817-11:58:52.496(2)? (STDERR) error on fast-rendering path: / ; error: Error: Can't set headers after they are sent.\r\n\tW20150817-11:58:52.496(2)? (STDERR)     at ServerResponse.OutgoingMessage.setHeader (http.js:690:11)\r\n\tW20150817-11:58:52.496(2)? (STDERR)     at ServerResponse.res.setHeader (/Users/fabienhuet/.meteor/packages/webapp/.1.2.0.15p5axz++os+web.browser+web.cordova/npm/node_modules/connect/lib/patch.js:59:22)\r\n\tW20150817-11:58:52.496(2)? (STDERR)     at next (/Users/fabienhuet/.meteor/packages/webapp/.1.2.0.15p5axz++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:153:13)\r\n\tW20150817-11:58:52.497(2)? (STDERR)     at next (/Users/fabienhuet/.meteor/packages/webapp/.1.2.0.15p5axz++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:127:23)\r\n\tW20150817-11:58:52.497(2)? (STDERR)     at processNextSubRouter (packages/meteorhacks:picker/lib/implementation.js:74:1)\r\n\tW20150817-11:58:52.497(2)? (STDERR)     at processNextSubRouter (packages/meteorhacks:picker/lib/implementation.js:74:1)\r\n\tW20150817-11:58:52.497(2)? (STDERR)     at processNextRoute (packages/meteorhacks:picker/lib/implementation.js:65:1)\r\n\tW20150817-11:58:52.497(2)? (STDERR)     at processNextMiddleware (packages/meteorhacks:picker/lib/implementation.js:48:1)\r\n\tW20150817-11:58:52.497(2)? (STDERR)     at packages/meteorhacks:fast-render/lib/server/routes.js:39:1\r\n\tW20150817-11:58:52.497(2)? (STDERR)     at packages/meteorhacks:fast-render/lib/server/routes.js:93:1\r\n\tW20150817-11:58:52.497(2)? (STDERR) error on fast-rendering path: / ; error: Error: Can't set headers after they are sent.\r\n\tW20150817-11:58:52.498(2)? (STDERR)     at ServerResponse.OutgoingMessage.setHeader (http.js:690:11)\r\n\tW20150817-11:58:52.498(2)? (STDERR)     at ServerResponse.res.setHeader (/Users/fabienhuet/.meteor/packages/webapp/.1.2.0.15p5axz++os+web.browser+web.cordova/npm/node_modules/connect/lib/patch.js:59:22)\r\n\tW20150817-11:58:52.498(2)? (STDERR)     at next (/Users/fabienhuet/.meteor/packages/webapp/.1.2.0.15p5axz++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:153:13)\r\n\tW20150817-11:58:52.498(2)? (STDERR)     at next (/Users/fabienhuet/.meteor/packages/webapp/.1.2.0.15p5axz++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:127:23)\r\n\tW20150817-11:58:52.498(2)? (STDERR)     at processNextSubRouter (packages/meteorhacks:picker/lib/implementation.js:74:1)\r\n\tW20150817-11:58:52.498(2)? (STDERR)     at processNextSubRouter (packages/meteorhacks:picker/lib/implementation.js:74:1)\r\n\tW20150817-11:58:52.499(2)? (STDERR)     at processNextRoute (packages/meteorhacks:picker/lib/implementation.js:65:1)\r\n\tW20150817-11:58:52.499(2)? (STDERR)     at processNextMiddleware (packages/meteorhacks:picker/lib/implementation.js:48:1)\r\n\tW20150817-11:58:52.499(2)? (STDERR)     at packages/meteorhacks:fast-render/lib/server/routes.js:20:1\r\n\tW20150817-11:58:52.499(2)? (STDERR)     at handleError (packages/meteorhacks:fast-render/lib/server/routes.js:106:1)\r\n\tW20150817-11:58:52.499(2)? (STDERR)\r\n\tW20150817-11:58:52.499(2)? (STDERR) /Users/fabienhuet/.meteor/packages/meteor-tool/.1.1.3.1wysac9++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245\r\n\tW20150817-11:58:52.504(2)? (STDERR) \t\t\t\t\t\tthrow(ex);\r\n\tW20150817-11:58:52.504(2)? (STDERR) \t\t\t\t\t\t      ^\r\n\tW20150817-11:58:52.504(2)? (STDERR) Error: Can't set headers after they are sent.\r\n\tW20150817-11:58:52.505(2)? (STDERR)     at ServerResponse.OutgoingMessage.setHeader (http.js:690:11)\r\n\tW20150817-11:58:52.505(2)? (STDERR)     at ServerResponse.res.setHeader (/Users/fabienhuet/.meteor/packages/webapp/.1.2.0.15p5axz++os+web.browser+web.cordova/npm/node_modules/connect/lib/patch.js:59:22)\r\n\tW20150817-11:58:52.505(2)? (STDERR)     at next (/Users/fabienhuet/.meteor/packages/webapp/.1.2.0.15p5axz++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:153:13)\r\n\tW20150817-11:58:52.505(2)? (STDERR)     at next (/Users/fabienhuet/.meteor/packages/webapp/.1.2.0.15p5axz++os+web.browser+web.cordova/npm/node_modules/connect/lib/proto.js:127:23)\r\n\tW20150817-11:58:52.505(2)? (STDERR)     at processNextSubRouter (packages/meteorhacks:picker/lib/implementation.js:74:1)\r\n\tW20150817-11:58:52.506(2)? (STDERR)     at processNextRoute (packages/meteorhacks:picker/lib/implementation.js:65:1)\r\n\tW20150817-11:58:52.506(2)? (STDERR)     at processNextMiddleware (packages/meteorhacks:picker/lib/implementation.js:48:1)\r\n\tW20150817-11:58:52.506(2)? (STDERR)     at packages/meteorhacks:fast-render/lib/server/routes.js:20:1\r\n\tW20150817-11:58:52.506(2)? (STDERR)     at handleError (packages/meteorhacks:fast-render/lib/server/routes.js:106:1)\r\n\tW20150817-11:58:52.506(2)? (STDERR)     at packages/meteorhacks:fast-render/lib/server/routes.js:95:1\r\n\t=> Exited with code: 8\r\n\r\n"}}