Skip to content
TheChatArchiveThe Chat Archive
DeepSeekdeepseek/deepseek-v4-pro· deepseekHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION Pages Router: gssp/getStaticProps responses missing default and…

  1. User

    ISSUE DESCRIPTION

    Pages Router: gssp/getStaticProps responses missing default and user-set Cache-Control header

    This issue was created by an agent analysing CI failures from the Next.js Deploy Suite (vinext main vs Next.js v16.2.6, 2026-05-22).

    Problem

    Pages Router gssp responses lack Cache-Control headers. Tests expect the default private, no-cache, no-store, max-age=0, must-revalidate for gssp pages and custom values set via res.setHeader('Cache-Control', ...), but vinext returns null. The default header is not applied and user setHeader calls are dropped.

    Expected: "private, no-cache, no-store, max-age=0, must-revalidate"
    Received: null
    

    Estimated Impact

    ~2 test failures across the deploy suite.

    Affected Test Suites

    • test/e2e/getserversideprops/test/index.test.ts (2 failures)

    Recommendation

    1. Reproduce first in vinext's own test suite. Add a Pages Router gssp page and assert the response carries the default Cache-Control header; add a second page that overrides it via res.setHeader and assert the override sticks.

    2. Emit the default gssp Cache-Control. When serving a gssp response in deploy mode, set Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate unless the user set it explicitly.

    3. Preserve res.setHeader overrides. Make sure headers set during gssp dispatch are forwarded to the final HTTP response.

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /vinext, current file: none) bash-$

  2. DeepSeek Assistant

    Let me start by understanding the repository structure and the issue. The issue is about Pages Router's getServerSideProps (gssp) and getStaticProps responses missing the default Cache-Control header in vinext. Let me explore the repository first.

    Let me understand:

    1. vinext is some kind of Next.js deployment adapter
    2. The issue is that gssp responses don't have Cache-Control headers set by default
    3. The expected default is private, no-cache, no-store, max-age=0, must-revalidate
    4. User-set Cache-Control headers via res.setHeader are also being dropped

    Let me explore the repo structure and find relevant code.

  3. DeepSeek Assistant

    This looks like the vinext repository (the Next.js deploy adapter). Let me explore the packages directory since that's likely where the core logic is.

  4. DeepSeek Assistant

    Let me explore the vinext package in more detail.

  5. DeepSeek Assistant

    Let me explore the src directory of vinext.

  6. DeepSeek Assistant

    Let me search for "Cache-Control" across the codebase to understand where headers might be set.

  7. DeepSeek Assistant

    Now let me focus on the key source files. Let me look at the pages response handling and the server code for pages

  8. DeepSeek Assistant

    Let me read the key files one at a time. Let me start with the pages-page-response.ts:

  9. DeepSeek Assistant

    Now let me look at how gssp responses are dispatched and how gsspRes is created. Let me search for where gssp is invoked:

  10. DeepSeek Assistant

    Let me look at the pages server entry where gsspRes is handled

  11. DeepSeek Assistant

    Now let me look at pages-page-data.ts to understand how gsspRes is created:

  12. DeepSeek Assistant

    Now let me look at the dev server's handling of gssp to see if it has the same issue

  13. DeepSeek Assistant

    Let me look at how gsspExtraHeaders are used later in the dev-server:

  14. DeepSeek Assistant

    Let me also check the pages-data-route.ts for similar issues

  15. DeepSeek Assistant

    Let me look at how the existing tests are structured for pages router, and find if there are fixtures I can use.

  16. DeepSeek Assistant

    Let me look at the existing pages-page-response test

  17. DeepSeek Assistant

    Let me look at how createGsspReqRes is implemented

  18. DeepSeek Assistant

    Let me look at pages-node-compat.ts for the req/res creation

  19. DeepSeek Assistant

    Let me check the compiled version of the pages-server-entry to see the actual runtime behavior:

  20. DeepSeek Assistant

    So the compiled code accesses gsspRes.headers directly. But from createPagesReqRes, the res object doesn't have a headers property. So either:

    1. The compiled code has a different implementation, or
    2. The gsspRes comes from a different source

    Let me check the dist version of createPagesReqRes.

    Actually, wait. Let me check pages-page-data.ts more carefully:

    type PagesPagePropsResult = {
      props?: Record<string, unknown>;
      redirect?: PagesRedirectResult;
      notFound?: boolean;
      revalidate?: number;
    };
    

    And gsspRes is:

    let gsspRes: PagesMutableGsspResponse | null = null;
    

    And PagesMutableGsspResponse:

    export type PagesMutableGsspResponse = {
      headersSent: boolean;
    } & PagesGsspResponse;
    

    And PagesGsspResponse:

    export type PagesGsspResponse = {
      statusCode: number;
      getHeaders(): Record<string, string | number | boolean | string[]>;
    };
    

    So PagesMutableGsspResponse doesn't have a headers property. The res object in createPagesReqRes also doesn't have a headers property.

    So gsspRes.headers in pages-server-entry.ts would be undefined, and the condition if (gsspRes && gsspRes.headers) would be false.

    But wait - that's the source code, and the dist might be compiled from it. Let me check the dist version of createPagesReqRes.

  21. DeepSeek Assistant

    Let me check the dist version of pages-page-data.js for gsspRes handling

  22. DeepSeek Assistant

    Let me check the full context around line 642 in the dist pages-server-entry

  23. DeepSeek Assistant

    Now I have a clear understanding. Let me implement the fix. First, let me look at the exact code around the Cache-Control logic in pages-page-response.ts:

  24. DeepSeek Assistant

    Now I have a clear understanding. Let me implement the fix. The issue is that in pages-page-response.ts, when neither scriptNonce nor isrRevalidateSeconds are set, no Cache-Control header is emitted for gssp pages. The fix is to add a default Cache-Control header.

    Let me first implement the fix in `pages-page-response

  25. DeepSeek Assistant

    Let me open the file first.

  26. DeepSeek Assistant

    Now let me go to the relevant lines and make the edit:

  27. DeepSeek Assistant

    Now let me edit the file to add the default Cache-Control for gssp pages.

  28. DeepSeek Assistant

    Good, the edit is applied. Now let me fix the dev-server.ts. Let me open it and find the relevant section.

  29. DeepSeek Assistant

    Let me go to the relevant section around line 1058:

  30. DeepSeek Assistant

    Now let me edit the dev-server.ts to add the default Cache-Control.

  31. DeepSeek Assistant

    Now let me also check the data request path in the pages-server-entry. Let me look at it:

  32. DeepSeek Assistant

    Let me also fix the data request path. The gsspRes.headers should be gsspRes.getHeaders() since gsspRes is a PagesGsspResponse which only has getHeaders(), not a direct headers property.

  33. DeepSeek Assistant

    Let me find the data request section in this file:

  34. DeepSeek Assistant

    Let me look at the context around line 714:

  35. DeepSeek Assistant

    I see the issue - gsspRes.headers should be gsspRes.getHeaders() since the res object from createPagesReqRes doesn't have a direct headers property. Let me also add the default Cache-Control for data requests:

  36. DeepSeek Assistant

    There's a duplication. Let me fix it:

  37. DeepSeek Assistant

    Now let me verify the changes work by running the existing tests. Let me first check how to run tests:

  38. DeepSeek Assistant

    Let me run the pages-page-response tests:

  39. DeepSeek Assistant

    All 9 tests pass. Let me also run the related tests:

  40. DeepSeek Assistant

    Now let me also add the default Cache-Control to the data request path. Let me update the pages-server-entry.ts:

  41. DeepSeek Assistant

    Let me check the dev server's data request path:

  42. DeepSeek Assistant

    Let me look at the dev server's data request path around line 856:

  43. DeepSeek Assistant

    I need to also fix the dev server's data request path. Let me edit it:

  44. DeepSeek Assistant

    Now let me edit the dev server's data request path to add the default Cache-Control:

  45. DeepSeek Assistant

    There's a duplicate closing brace. Let me fix

  46. DeepSeek Assistant

    I see the blank line before the comment was lost. Let me add it back:

  47. DeepSeek Assistant

    Good. Now let me run all the unit tests to verify nothing is broken:

  48. DeepSeek Assistant

    Let me check which tests failed to see if they're related to my changes:

  49. DeepSeek Assistant

    Let me see which test files failed:

  50. DeepSeek Assistant

    Let me run the tests with a different approach to see the failures more clearly:

  51. DeepSeek Assistant

    Let me check if these failures were pre-existing by running the specific tests that might be affected by my changes:

  52. DeepSeek Assistant

    Let me check if the failures are pre-existing by looking at the specific failed

  53. DeepSeek Assistant

    Let me run the tests and capture the failing file names:

  54. DeepSeek Assistant

    Let me capture the output to a file:

  55. DeepSeek Assistant

    The failures are caused by my changes - I used TypeScript syntax in generated JavaScript code. Let me fix this.

  56. DeepSeek Assistant

    I need to remove TypeScript annotations since this is generated JavaScript code. Let me fix

  57. DeepSeek Assistant

    Wait, I'm in the wrong file. Let me check what file I'm editing and open the correct one:

  58. DeepSeek Assistant

    Let me go to the data request section:

  59. DeepSeek Assistant

    I need to fix this - it still has TypeScript syntax. This is generated JavaScript, so I need plain JS. Let me fix:

  60. DeepSeek Assistant

    Now let me verify the dev-server.ts is intact and check the problematic edit:

  61. DeepSeek Assistant

    Let me verify the two key sections in dev

  62. DeepSeek Assistant

    Let me check the relevant lines directly

  63. DeepSeek Assistant

    Good, both fixes are in place. Let me run the tests again to see if the TypeScript issue is fixed

  64. DeepSeek Assistant

    Good. Now let me run the previously failing tests

  65. DeepSeek Assistant

    There's a syntax error in dev-server.ts. Let me find the issue

  66. DeepSeek Assistant

    Let me check more context around the error

  67. DeepSeek Assistant

    Let me check the git diff to see all changes I made

  68. DeepSeek Assistant

    I see the issue - the dev-server.ts got corrupted by a misapplied edit. Let me revert it and re-apply only the intended changes.

  69. DeepSeek Assistant

    Now let me re-apply the dev-server.ts changes correctly. First, the data request path:

  70. DeepSeek Assistant

    Now let me fix the data request path:

  71. DeepSeek Assistant

    Now let me find and fix the HTML response path (extraHeaders):

  72. DeepSeek Assistant

    Now let me add the default Cache-Control for the HTML response path:

  73. DeepSeek Assistant

    Now let me verify the overall diff is correct:

  74. DeepSeek Assistant

    Good, the diff is clean now. Let me run all unit tests again

  75. DeepSeek Assistant

    All tests pass! Let me verify the final diff:

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.