Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.graphqlHandler = function graphqlHandler(event: any, context: any, callback: any) {
log.info('hit graphql');
function callbackFilter(error: any, output: any) {
// eslint-disable-next-line no-param-reassign
if (output) {
output.headers['Access-Control-Allow-Origin'] = '*';
log.info(output.body);
} else {
log.error(error);
}
callback(error, output);
}
const handler = graphqlLambda({ schema: myGraphQLSchema, tracing: true });
return handler(event, context, callbackFilter);
};