Calls are being made to localhost, instead of given uri, using new HttpLink()
See original GitHub issueIntended outcome:
Http calls go to https://actual-website.com/graphql/
.
Actual outcome:
Http calls are being made to http://localhost:3000/graphql/
.
Console errors:
POST http://localhost:3000/graphql 404 (Not Found)
Unhandled (in react-apollo:Apollo(DomainsView)) Error: Network error: Unexpected token < in JSON at position 0
at new ApolloError (http://localhost:3000/main.js:39001:28)
at ObservableQuery.currentResult (http://localhost:3000/main.js:38445:24)
at GraphQL.dataForChild (http://localhost:3000/main.js:34830:62)
at GraphQL.render (http://localhost:3000/main.js:34880:33)
at http://localhost:3000/main.js:71999:21
at measureLifeCyclePerf (http://localhost:3000/main.js:71279:12)
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext (http://localhost:3000/main.js:71998:25)
at ReactCompositeComponentWrapper._renderValidatedComponent (http://localhost:3000/main.js:72025:32)
at ReactCompositeComponentWrapper._updateRenderedComponent (http://localhost:3000/main.js:71949:36)
at ReactCompositeComponentWrapper._performComponentUpdate (http://localhost:3000/main.js:71927:10)
How to reproduce the issue:
In the following codesandbox I’ve loaded the exact same versions of apollo packages I use in my own app. The error also occurs here, except the url called seems to default to https://n7z74xx7oj.codesandbox.io/graphql
, instead of the given https://qkv3mq9rp.lp.gql.zone/graphql
. I also cannot seem to find the Authorization header in the requests.
https://codesandbox.io/s/n7z74xx7oj
Version
- apollo-boost@0.1.1
- apollo-client@2.2.5
- apollo-link@1.2.1
- apollo-link-context@1.0.7
- apollo-link-http@1.5.1
- graphql@0.12.3
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (1 by maintainers)
Top Results From Across the Web
HTTP Link - Apollo GraphQL Docs
A function to use instead of calling the Fetch API directly when sending HTTP requests to your GraphQL endpoint. The function must conform...
Read more >Access to fetch at 'http://localhost:6969/graphql' from origin ' ...
If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. I am learning...
Read more >Automatically handling Apollo Client errors in your React UI
new HttpLink ({ uri: "http://localhost:4000" }) ... occurs in a hook and there's no specific error handling being done at that call-site, ...
Read more >http.client — HTTP protocol client — Python 3.11.1 ...
An HTTPConnection instance represents one transaction with an HTTP server. ... _create_unverified_context() can be passed to the context parameter.
Read more >Using Apollo to Query GraphQL from Node.js
Getting Started. First, let's get all our files and dependencies in place. Create a folder called nodejs-apollo-client and open it in your ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Apologies, it seems that I was using the wrong import statements;
What I had:
import ApolloClient from 'apollo-boost';
. What fixed it for me (which is also what is written in the docs):import { ApolloClient } from 'apollo-client';
.Not sure how I got this wrong…
Ignore me, I noticed the typo
url
instead ofuri
, I’ll go back to shouting at clouds and telling kids to get off my lawn! 😃