diff --git a/src/apolloClient.ts b/src/apolloClient.ts index a516729ed..a4cf6706c 100644 --- a/src/apolloClient.ts +++ b/src/apolloClient.ts @@ -28,20 +28,24 @@ if (NODE_ENV !== 'production') { }; } +const generateDataSources = () => { + return { + EngagesAPI: new EngagesAPI(), + IntegrationsAPI: new IntegrationsAPI(), + }; +}; + const apolloServer = new ApolloServer({ typeDefs, resolvers, - dataSources: () => { - return { - EngagesAPI: new EngagesAPI(), - IntegrationsAPI: new IntegrationsAPI(), - }; - }, + dataSources: generateDataSources, playground, uploads: false, context: ({ req, res }) => { if (!req || NODE_ENV === 'test') { - return {}; + return { + dataSources: generateDataSources(), + }; } const user = req.user;