502 error with /graphql after express-graphql migration to graphql-http #93
              
                Unanswered
              
          
                  
                    
                      blee-deloitte
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment
-
| Not sure where the 502 error comes from, probably express itself since graphql-http has no code points setting it. I'd recommend reading first the  
 If the problems persist, I am kindly asking you to create a repro that I can check out. This should expedite the debugging process. Thanks! | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, first i really appreciate all the works and docs that you guys are supporting to us.
I have been trying to migrate express-graphql to graphql-http but it errors out with 502 server error when i tried.
I found all the available handlerOptions from graphql-http doc and console logged all the correct path of req values to rootValue and context.
Is there anything that i am missing or approaching it in a wrong way?
Here is the migration codes that i created (FYI, the graphqlHTTP from express-graphql is working as expected with the codes below)
FROM
app.use('/graphql', graphqlHTTP(req =>
{
return {
schema,
rootValue: req.rawHeaders,
context: req.headers,
graphiql:process.env.NODE_ENV==='development'?true:false,
validationRules: [NoIntrospection]
}
}
))
TO
app.all('/graphql', createHandler({
schema,
rootValue: req => req.raw.rawHeaders,
context: req => req.headers,
graphiql:process.env.NODE_ENV==='development'?true:false,
validationRules: [NoIntrospection]
}))
Thank you so much!
Beta Was this translation helpful? Give feedback.
All reactions