Apollo Client not sending cookies to backend server on localhost

Hi guys,

I’m using “@apollo/experimental-nextjs-app-support/ssr” in Next App router, in some “use client” components and trying to interface with my Keystone backend server.

I know the sign in mutation works because it returns the User object and I can view it in the Apollo Cache, however, although it creates a session cookie, Apollo does not seem to be sending the session cookie to the serverside when I try to authenticate the user.

I believe the

credentials: "include"

flag is what enables sending out headers/cookies right? Maybe I put it in the incorrect place or misconfigured it? Since I’m using this with Nextjs 13, I used the experimental-nextjs-app-support package, which I’m less familiar with so could it be that I misconfigured something there?

I used it like this:

const makeClient = () => {
  const httpLink = new HttpLink({
      uri: "http://localhost:3000/api/graphql",

  return new ApolloClient({
    cache: new NextSSRInMemoryCache(),
    connectToDevTools: true,
    credentials: 'include',
      typeof window === "undefined"
        ? ApolloLink.from([
            new SSRMultipartLink({
              stripDefer: true,
        : httpLink,

Anyone have any idea that can help? This is all in localhost dev environment btw. Thanks in advance!

Hi @mcds :wave: welcome to the forum!

The credentials option in the ApolloClient constructor is there for convenience. ApolloClient will instantiate a new link if there’s none provided. That’s where the credentials option comes in handy:

Since you’re passing a link to the constructor, try moving credentials: "include" to the HttpLink options:

  const httpLink = new HttpLink({
      uri: "http://localhost:3000/api/graphql",
      credentials: "include",

Hope that helps!