Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in ctx.req parameters availability in Document getInitialProps in version 13.4.13 (works in 13.4.12) #53883

Closed
1 task done
carystanley opened this issue Aug 10, 2023 · 5 comments
Labels
bug Issue was opened via the bug report template. locked Pages Router Related to Pages Router.

Comments

@carystanley
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:05 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T6000
    Binaries:
      Node: 16.19.0
      npm: 9.2.0
      Yarn: N/A
      pnpm: N/A
    Relevant Packages:
      next: 13.4.14-canary.1
      eslint-config-next: 13.2.4
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 4.9.5
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

Data fetching (gS(S)P, getInitialProps)

Link to the code that reproduces this issue or a replay of the bug

https://github.com/carystanley/nextjs-req-context-regression

To Reproduce

Clone the repo at https://github.com/carystanley/nextjs-req-context-regression, install and use npm run dev

go to: http://localhost:3000/
see page with:

Fail: Missing Header Data
Hello World

run npm i next@13.4.12

use npm run dev

go to: http://localhost:3000/
see page with:

Has Header Data
Hello World

Describe the Bug

Not sure if this bug is specific in our setup. But we have express running and we have middleware that adds "context" to the req object. We then use that information in our Document getInitialProps(ctx) to make a data call for the header which is customized based on req.context and other req.* metadata.

This worked fine in version 13.4.12, but some regression occurred in 13.4.13 that has cause the additional req.* metadata to no longer be available.

This was a breaking change that broke our application

Expected Behavior

We would expect it to operate like it did in version 13.4.12 where req.* information on the req object in Document getInitialProps(ctx) was still available.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

express

@carystanley carystanley added the bug Issue was opened via the bug report template. label Aug 10, 2023
@github-actions github-actions bot added the Pages Router Related to Pages Router. label Aug 10, 2023
@ehwarren
Copy link

Possibly the same issue,

attempting any of the login/logout methods through Next-Auth is broken on localhost in version 13.4.13, it always redirects to https:// which doesn't work for localhost.

in 13.4.12, the proto from the original request is retained, in the case of localhost, this is http:.

I know they are using server context as well, so i'm assuming this is the issue but I haven't dove in.

@sshah98
Copy link

sshah98 commented Aug 18, 2023

Possibly the same issue,

attempting any of the login/logout methods through Next-Auth is broken on localhost in version 13.4.13, it always redirects to https:// which doesn't work for localhost.

in 13.4.12, the proto from the original request is retained, in the case of localhost, this is http:.

I know they are using server context as well, so i'm assuming this is the issue but I haven't dove in.

did you ever figure out if this is the issue? I'm getting the same thing -- but nothing has been pushed up for a fix

@balazsorban44
Copy link
Member

balazsorban44 commented Aug 23, 2023

Closing in favor of #54440. Feel free to comment there!

@carystanley
Copy link
Author

Consolidation is fine, as long as this regression is ultimately fixed

@github-actions
Copy link
Contributor

github-actions bot commented Sep 7, 2023

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot added the locked label Sep 7, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked Pages Router Related to Pages Router.
Projects
None yet
Development

No branches or pull requests

4 participants