Getting 502 error on long query only over https

11/5/2019

I have a rather long query on my gql server, the resolver calls a grpc method. when I run this locally it works, but when I make the query on our development deployment(https) the request comes back with

<html><head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>502 Server Error</title>
</head>
<body text=#000000 bgcolor=#ffffff>
<h1>Error: Server Error</h1>
<h2>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds.</h2>
<h2></h2>
</body></html>

There are other grpc calls that work, over https as well. So I don't think it is any issue there..

In the gcp logs I can actually see the result from the resolver logged. although in the browser it comes as a 502 error.

my resolver

train: async (parent, args) => {
      const { projectId, yml } = args
      let result = await nluTrain(projectId, yml);
      return { done:result }
    }

my server

const server = new ApolloServer({
  typeDefs: schema,
  resolvers,
  context: async ({ req, connection}) => {
    if(req){
      return {
        req,
      };
    }
  },
});


server.applyMiddleware({ app, path: '/graphql' });
const httpServer = http.createServer(app);
server.installSubscriptionHandlers(httpServer);
httpServer.listen({ port: 8001 }, () => {
  console.log('Apollo Server on http://localhost:8001/graphql');
});
-- Jeremy Nelson
apollo-server
google-kubernetes-engine
graphql
grpc

0 Answers