Closed lorensr closed 6 years ago
Perhaps helpful. When using async / await, and using the babel-polyfill
to fix the error quoted by @lorensr above, Graphiql
returns the following error on the async query:
"message": "Match error: Failed Match.OneOf, Match.Maybe or Match.Optional validation",
I have no idea what or where the Match failed.
I believe @smeijer is right, @lorensr, to include the babel-polyfill package.
We use the webpack:webpack package in our Meteor setup, and I eliminated the regeneratorRuntime error by using something like this for the resolvers:
import { Random } from 'meteor/random';
import 'babel-polyfill';
export const typeDefs = [`
type Email {
address: String
verified: Boolean
}
type User {
emails: [Email]
username: String
randomString: String
}
type Query {
user(id: String!): User
}
schema {
query: Query
}
`];
export const resolvers = {
Query: {
async user(root, args, context) {
// Only return the current user, for security
if (context.userId === args.id) {
return await Meteor.users.findOne(context.userId);
}
}
},
User: {
emails: ({ emails }) => emails,
randomString: () => Random.id()
}
};
Is it still relevant? This issue happened before Meteor 1.4.2.1 and babel-runtime
requirement for Babel transform.
If yes, do you think we should have a note in the docs mentioning this issue & fix?
(assumption about the problem: if the right preset/plugins are added in .babelrc
, is babel-polyfill
needed? 🤔 )
https://atmospherejs.com/webpack/webpack
Using
async/await
gives this error:Taken from https://github.com/apollostack/meteor-integration/issues/25#issuecomment-238658365