Skip to content

Commit

Permalink
graphql: limit error logging to not leak info
Browse files Browse the repository at this point in the history
  • Loading branch information
mimecuvalo committed Mar 3, 2023
1 parent 294b3f5 commit 0295aa6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pages/api/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { NextApiRequest, NextApiResponse } from 'next';

import { ApolloServer } from 'apollo-server-micro';
import { createContext as context } from 'data/context';
import pick from 'lodash/pick';
import resolvers from 'data/resolvers';
import typeDefs from 'data/schema';

Expand All @@ -10,6 +11,9 @@ const apolloServer = new ApolloServer({
resolvers,
context,
cache: 'bounded', // Prevent DOS. See: https://www.apollographql.com/docs/apollo-server/performance/cache-backends/
formatError: (err) => {
return pick(err, 'message');
},
});

const startServer = apolloServer.start();
Expand Down

0 comments on commit 0295aa6

Please sign in to comment.