apollo-server icon indicating copy to clipboard operation
apollo-server copied to clipboard

Adding `deferSpec=20220824` to response headers breaks the Preview pane in browser devtools

Open jer-k opened this issue 1 year ago • 0 comments

Issue Description

As I was working on improving the @defer support for Next.js in https://github.com/apollo-server-integrations/apollo-server-integration-next/pull/204 I noticed that when I viewed the Preview pane in Chrome devtools, it was always blank.

image

I thought it might be something going on with Next.js, but I believe it is an issue with the headers being set here https://github.com/apollographql/apollo-server/blob/main/packages/server/src/runHttpQuery.ts#L305.

  graphQLResponse.http.headers.set(
    'content-type',
    'multipart/mixed; boundary="-"; deferSpec=20220824',
  );

In my Next.js app, I rewrote the headers to be

    const headers: Record<string, string> = {
      'content-type': 'multipart/mixed; boundary="-"',
    };

And the data appears in the Preview pane image.

Is there any reason to add the deferSpec=20220824 to the response header? Without it Apollo Client behaves properly and the devtools are able to preview the response data.

Link to Reproduction

https://github.com/apollo-server-integrations/apollo-server-integration-next/pull/204

Reproduction Steps

I linked to the PR from the Next.js integration where I detailed all of this. I also have a project https://github.com/jer-k/graphql-rsc-dashboard which has a local version of @as-integrations/next installed where I'm testing this. I can create a branch of this project that sets everything up to be pulled down if need be.

jer-k avatar Jul 30 '24 15:07 jer-k