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 was archived by the owner on Apr 14, 2023. It is now read-only.
But if I use my axios instance (which is called 'api' in the code reproduction), i get the following error :
response: { status: 500, statusText: 'Internal Server Error', headers: [Object], config: [Object], request: [ClientRequest], data: 'POST body missing. Did you forget use body-parser middleware?' },
A simple reproduction
`import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { HttpLink } from 'apollo-link-http';
import api from '#lib/api/api';
// Update the GraphQL endpoint to any instance of GraphQL that you like
const GRAPHQL_URL = 'https://api.graphql.jobs/';
const link = new HttpLink({
uri: GRAPHQL_URL, // Server URL (must be absolute)
credentials: 'same-origin', // Additional fetch() options like credentials or headers
fetch: api,
});
export default function createApolloClient(initialState, ctx) {
// The ctx (NextPageContext) will only be present on the server.
// use it to extract auth headers (ctx.req) or similar.
return new ApolloClient({
ssrMode: Boolean(ctx),
link,
cache: new InMemoryCache().restore(initialState),
});
}
`
The text was updated successfully, but these errors were encountered:
Hello !
Expected Behavior
My project has an existing Axios client configured and I want to use it as fetch implementation for Apollo-Client http link.
Actual Behavior
I'm working on a nextJs project, and I used the Nextjs example to implement the apollo client : https://github.com/zeit/next.js/tree/canary/examples/with-apollo. If I use 'isomorphic-unfetch' as fetch implementation it's working great.
But if I use my axios instance (which is called 'api' in the code reproduction), i get the following error :
response: { status: 500, statusText: 'Internal Server Error', headers: [Object], config: [Object], request: [ClientRequest], data: 'POST body missing. Did you forget use body-parser middleware?' },
A simple reproduction
`import { ApolloClient } from 'apollo-client';
import { InMemoryCache } from 'apollo-cache-inmemory';
import { HttpLink } from 'apollo-link-http';
import api from '#lib/api/api';
// Update the GraphQL endpoint to any instance of GraphQL that you like
const GRAPHQL_URL = 'https://api.graphql.jobs/';
const link = new HttpLink({
uri: GRAPHQL_URL, // Server URL (must be absolute)
credentials: 'same-origin', // Additional fetch() options like
credentials
orheaders
fetch: api,
});
export default function createApolloClient(initialState, ctx) {
// The
ctx
(NextPageContext) will only be present on the server.// use it to extract auth headers (ctx.req) or similar.
return new ApolloClient({
ssrMode: Boolean(ctx),
link,
cache: new InMemoryCache().restore(initialState),
});
}
`
The text was updated successfully, but these errors were encountered: