Hey All,
I have an issue after setting up the graphiQLHeader for my playground. When I deploy to production, I receive an error message telling me that the entire GraphQL API is down (404 not found).
After some probing around, we noticed that if we change the api/src/functions/graphql.ts
from:
import { createGraphQLHandler } from '@redwoodjs/graphql-server'
import directives from 'src/directives/**/*.{js,ts}'
import sdls from 'src/graphql/**/*.sdl.{js,ts}'
import { db } from 'src/lib/db'
import { logger } from 'src/lib/logger'
import services from 'src/services/**/*.{js,ts}'
import generateGraphiQLHeader from 'src/lib/generateGraphiQLHeader'
import { getCurrentUser } from 'src/lib/auth'
export const handler = createGraphQLHandler({
getCurrentUser,
loggerConfig: { logger, options: {} },
generateGraphiQLHeader,
directives,
sdls,
services,
onException: () => {
// Disconnect from your database with an unhandled exception.
db.$disconnect()
},
})
to comment out the generateGraphiQLHeader
, then production runs without issue.
I conclude that the issue is on Production only, and I may need to only conditionally add the generateGraphiQLHeader
in my createGraphQLHandler()
. How would I do this? Anybody else have this problem? What is the best path to fix it?