Search code examples
lambdagraphqlapolloserverlessapollo-server

Apollo Server + Lambda + Subscriptions


Is it possible to run an Apollo GraphQL Lambda backend with subscriptions? As I understand, GraphQL subscriptions use websockets, so I suppose it won't be possible unless you use Redis as message broker but I want to validate it this as it's not stated in any part of Apollo Docs.


Solution

  • GraphQL subscriptions are not supported with Lambda, Google Cloud functions, or Azure functions or most other serverless vendors. This is because the instance is shutdown when traffic is low, which kills the websocket connection. There are a few experimental setups that have gotten it to work, but I have not tried any of them myself.

    You can find more information about this here.

    I hope this helps!