In the resolver throw new createError.BadRequest("bad input")
error is hijacked by Graphql-shield
and shown as
{
"errors": [
{
"message": "Not Authorised!",
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"myMutation"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"stacktrace": [
"Error: Not Authorised!",
This is the Apollo Server setup
const schema = buildSubgraphSchema([
{ typeDefs: await typeDefs(), resolvers },
]);
const apolloServer = new ApolloServer({
schema: applyMiddleware(schema, permissions),
context: async ({ req, res }) => new AuthenticatedContext(req, res)
});
How do I return the actual error occuring?
I found the solution on shield documentation:
The allowExternalErrors option is defaulted to be false according to the documentation.