Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Meteor code must always run within a Fiber #66

Open
s7dhansh opened this issue Apr 3, 2019 · 2 comments
Open

Error: Meteor code must always run within a Fiber #66

s7dhansh opened this issue Apr 3, 2019 · 2 comments

Comments

@s7dhansh
Copy link
Contributor

s7dhansh commented Apr 3, 2019

I get this error when I use Meteor.user() inside withTracker functions, only on server.

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

It happens at this line in the react-meteor-data package: https://github.com/meteor/react-packages/blob/796a075a4bbb36212e6a74c9f3576b119d31c474/packages/react-meteor-data/ReactMeteorData.jsx#L34

Meteor.bindEnvironment can't be used because it eats up the return values.

Any ideas for solving this?

@bensventures
Copy link

Having the same problem, on the server as well, in both with and without HMR. I have Meteor methods calling some async functions and that seems to break.

@bensventures
Copy link

bensventures commented Jan 10, 2020

So right after writing my previous comment I remembered having faced a similar issue in the past, before I used this package. It seems that using babel to transpile your code for the current version of node breaks Fibers somehow. If you change it back to node 7, it works.

So in other words I had this as part of my babel config:

...
"presets": [
        "@babel/preset-react",
        [
            "@babel/preset-env", {
            "targets": {
                "node": "current"
            },
            "modules": false
        }
        ]
    ]
...

and I changed it to:

...
"presets": [
        "@babel/preset-react",
        [
            "@babel/preset-env", {
            "targets": {
                "node": "7"
            },
            "modules": false
        }
        ]
    ]
...

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

No branches or pull requests

2 participants