CORS blocks mutation in GraphQL Yoga
The solution to the problem was to write a middleware that sets appropriate response headers so that the fetch doesn't fail.
server.express.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', 'http://localhost:7777');
res.header(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept'
);
next();
});
The above is the yoga express server middleware used to solve the problem.