Mutations in Meteor
See original GitHub issueHi, I’m using apollo-client with Meteor and default MongoDB. All queries work nicely, but none of my mutations seem to work as I’m getting the famous error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment
I tried wrapping it in AsyncCallback, I even tried to bind it to environment but nothing seems to workl 😭
const resolvers = {
Query: {
async posts(root, args) {
return Posts.find({}).fetch();
},
Mutation: {
async addPost(root, { title, content }) {
let asyncCall = Meteor.bindEnvironment(function() {
Posts.insert({ title: title, content: content });
return Posts.find({}).fetch();
});
return asyncCall();
},
}
};
Issue Analytics
- State:
- Created 7 years ago
- Comments:20 (9 by maintainers)
Top Results From Across the Web
What are the steps to perform meteorite mutations? : r/ancestors
What are the steps to perform meteorite mutations? · bring 6 babies to meteor site. · inspect meteor site. · wait until you...
Read more >4: Using GraphQL to Change Data - Meteor React Tutorial
Let's create a mutation to insert tasks, and once more start with the server side. We'll insert a save function inside the TasksCollection...
Read more >Meteor Feet Mutation | The Eternal Cylinder Wiki - Fandom
Obtained from Barbagar's Foot. This mutation can be permanently activated by mixing 1 Barbagar's Foot, 2 Furtree Cones, and 3 Refined Minerals.
Read more >cultofcoders:mutations - Packosphere
We go with Meteor on the road of CQRS and we want to separate fully the way we deal with fetching data and...
Read more >Introduction To Mutations | Full-stack GraphQL with Apollo ...
Introduction To Mutations. In this free series, I'll be teaching GraphQL with Apollo, Meteor & React to build a full-stack app.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you @stubailo that did it.
Still a noob here … but getting there. I know you guys are not a support forum for GraphQL so I really appreciate your responses. It’s just that your approach is a bit different (and I like it more) that what you find in the classic GraphQL examples online. I really love the way you just use schemas for the definition and separate resolvers. Awesome work! Thanks.
The minute you need to use bindEnvironment, and Fibers and all this complex stuff means Apollo didn’t do its job. And i know thats not the case.