You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.
overview.js:80369 Error: Network error: Unexpected token I in JSON at position 0
at new ApolloError (overview.js:70404)
at ObservableQuery.webpackJsonp.../../../../../public/next/next-apollo/node_modules/.registry.npmjs.org/apollo-client/2.2.0/node_modules/apollo-client/core/ObservableQuery.js.ObservableQuery.currentResult (overview.js:68953)
at ProxyComponent.Query._this.getQueryResult (overview.js:52088)
at ProxyComponent.webpackJsonp.../../../../../../node_modules/.registry.npmjs.org/react-apollo/2.1.0-rc.3/node_modules/react-apollo/Query.js.Query.render (overview.js:52184)
at ProxyComponent.proxiedRender (main.js:38683)
at finishClassComponent (main.js:30599)
at updateClassComponent (main.js:30576)
at beginWork (main.js:30951)
at performUnitOfWork (main.js:32950)
at workLoop (main.js:33014)
Expected Behavior
Actual Behavior
A simple reproduction
Issue Labels
has-reproduction
feature
docs
blocking
good first issue
The text was updated successfully, but these errors were encountered:
We run into this same issue (at Netflix) because of proxies that we sometimes have in front. We are currently thinking of wrapping fetch to handle this either in a reactive way:
constcustomFetch=(uri,options)=>{returnfetch(uri,options).catch(err=>{// If it's our Content-Type issue from our proxy,// reformat the error to match ApollothrownewError(...)}};constlink=createHttpLink({fetch: customFetch});
or in a proactive way -- we do the validation then pass it on.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Default accept header is set to
*/*
:apollo-link/packages/apollo-link-http-common/src/index.ts
Line 98 in a79f47e
But we incorrectly assume that response is json, and tries to
JSON.parse(bodyText)
, without checkingbodyText
's content-type.apollo-link/packages/apollo-link-http-common/src/index.ts
Lines 123 to 137 in a79f47e
If your server returns a 403
text/plain
for example:Apollo throws a strange error:
Expected Behavior
Actual Behavior
A simple reproduction
Issue Labels
The text was updated successfully, but these errors were encountered: