From 2e1990f0e03aec5635267125ea8a5c023a8f9f68 Mon Sep 17 00:00:00 2001 From: Flacial Date: Tue, 27 Sep 2022 02:28:40 +0400 Subject: [PATCH] fix: GET query missing for `/api/graphql` --- pages/api/graphql.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pages/api/graphql.ts b/pages/api/graphql.ts index eb7415ee8..54886520e 100644 --- a/pages/api/graphql.ts +++ b/pages/api/graphql.ts @@ -9,7 +9,7 @@ import userMiddleware from '../../helpers/middleware/user' import sessionMiddleware from '../../helpers/middleware/session' // VERCEL_ENV is a reserved env key by Vercel that specify the deployment type: "preview", "production", or "deployment" -const isPreview = process.env.VERCEL_ENV !== 'preview' +const isPreview = process.env.VERCEL_ENV === 'preview' const handler = nextConnect() const apolloServer = new ApolloServer({ @@ -20,8 +20,10 @@ const apolloServer = new ApolloServer({ By default apolloServer accepts uploads, while schema-generated server does not.*/ uploads: false, plugins: [apolloLogPlugin], - playground: isPreview, - introspection: isPreview + ...(isPreview && { + playground: isPreview, + introspection: isPreview + }) }) const graphQLHandler = apolloServer.createHandler({ path: '/api/graphql' })