Can I have a graphQL API as a upstream using kong gateway?

Actually, the issue is as you are running kong in a docker container, localhost means the kong container itself, and what you should do is run your graphql service also in a docker container within the same network as your kong and configure your service with the IP of your graphql service.

Getting your GraphQL service IP
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}'  your-container-name
1 Like