Apollo Server + Express stuck in In Progress

SOLVED!

Hi all,

Have been stuck on this issue for a bit. Render seems to handle everything quite well, but no idea why this particular issue is cropping up.

I have an apollo server with an express middleware, and I’m doing something quite straightforward —

I call a function –


export default async (app: Application): Promise<void> => {
  const server = new ApolloServer({
      ...some configs here
  });
  await server.start();
  server.applyMiddleware({ app, path: "/" });
  app.listen(4000, "0.0.0.0");
  console.log(
    `🚀 Server ready!`
  );
};

The app builds correctly, the start command succeeds and logs “:rocket: Server ready!” but the deploy is stuck as “In progress” and eventually times out and fails. Oddly, the exact same code was working at some point.

EDIT

SOLVED! For those reading in the future, here is a one-stop list of things I found:

Bind the express app to the 0.0.0.0 hostname (this did not solve my issue, but seems to be the way to go?)

You cannot simply res.send(200) at a particular route and use that as a health check. This is odd since the docs specify that all that is needed for a successful healthcheck is a 200 response. Anyhow, Apollo comes with a (better?) built-in health check at /.well-known/apollo/server-health which did the trick.

As the Render docs specify here the zero-downtime deploys also mean that a deploy is not marked “live” until the the health check returns 200.

Great find, thanks for sharing with everyone!