Skip to content

Commit

Permalink
fix: GET query missing for /api/graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
flacial committed Sep 26, 2022
1 parent f30c846 commit 2e1990f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pages/api/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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' })
Expand Down

0 comments on commit 2e1990f

Please sign in to comment.