dotansimha/graphql-yoga

Errors thrown from context creator functions are not handled properly

Closed this issue · 3 comments

Example:
`import { GraphQLServer } from "graphql-yoga";

const server = new GraphQLServer({
context: async ({request, response}) => {
throw new Error('bla');
},
schema
});`

Client shows {
"error": "Unexpected token I in JSON at position 0"
}
When looking in Chrome dev tools I see "Invalid options provided to ApolloServer: bla"

I'd expect the client to show {
"error": "bla"
}

Thanks

stale commented

Due to inactivity of this issue we have marked it stale. It will be closed if no further activity occurs.

I ran into the same issue today. Seems like the initial error message is swallowed.

Hey @GilHelfgott @benjixx we @the-guild-org are the new maintainers of this project. We are actively developing v2 and this should be addressed in the new version. Would love to get your feedback on beta @graphql-yoga/node@beta release!