简体   繁体   中英

Apollo studio is not working after running Apollo server with google cloud load balancing

I am unable to connect to my Apollo (graphql) server through Apollo Studio ( https://studio.apollographql.com/sandbox/explorer ) OR Apollo Client library on frontend. But the server is working fine when a request is sent through Postman, graphql-request library OR a CURL request.

Details of Deployment:

The server is deployed on GCP instance groups which include 4 instances in two different regions. I have used Nginx as reverse proxy to redirect traffic to localhost:4000 of each instance (the app is running on port 4000 of each machine). The instance groups are attached to the GCP HTTPS load balancer. The backends are in the healthy state in the load balancer.

Apollo studio - not working

Postman - working

If it's working in postman but not in studio, it's generally either an issue with CORS, some other header issue, or something similar to that.

Studio is running in a browser, so things will be a big more finicky. It will send headers that browsers always send, like the origin it's running on, and those that Apollo decides are best, like certain accept / content-type headers that your load balancer might not be allowing through.

Things like Postman and cURL generally come with less "baggage". They only send the headers and content you ask them to.

The best thing to check next is what your browser thinks is going wrong, since servers won't "lie" about the problem unless you specifically tell it to (eg for security reasons, some information is sometimes best left out). Open up your browser debugger on the Studio website when you try to make a request and check your Network panel. The HTTP call will fail in a certain way if it's one of these issues, and it should be pretty straight-forward with you that it was rejected because of X.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM