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

Data inside the res.locals object from express in custom server is not available in pages/ after version 13.4.13+ #54381

Closed
1 task done
skogie opened this issue Aug 22, 2023 · 4 comments
Labels
bug Issue was opened via the bug report template. locked

Comments

@skogie
Copy link

skogie commented Aug 22, 2023

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.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000
    Binaries:
      Node: 18.12.1
      npm: 8.19.2
      Yarn: 1.22.17
      pnpm: 8.0.0
    Relevant Packages:
      next: 13.4.20-canary.2
      eslint-config-next: 13.4.20-canary.2
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
      output: N/A

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

No response

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

https://github.com/skogie/test-custom-express-server-next

To Reproduce

run yarn && yarn dev navigate to http://localhost:3000, you should see it says Data: My bad data because res.locals is undefined in next 13.4.13+ in pages/_app

Describe the Bug

After upgrading to 13.4.13 and above we are no longer able to use data set on res.locals inside the express custom server in pages/_app.tsx

Expected Behavior

Whats expected to happen is that http://localhost:3000 renders with the page saying Data: My nice data, this works when using next version 13.4.12

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@skogie skogie added the bug Issue was opened via the bug report template. label Aug 22, 2023
@skogie skogie changed the title Custom data on res from express in custom server is not available in pages/ Data inside the res.locals object from express in custom server is not available in pages/ Aug 22, 2023
@skogie skogie changed the title Data inside the res.locals object from express in custom server is not available in pages/ Data inside the res.locals object from express in custom server is not available in pages/ after version 13.4.13+ Aug 22, 2023
@Will956
Copy link
Contributor

Will956 commented Aug 22, 2023

+1, we have the same issue when trying to upgrade to v13.4.13. We set custom information within req in our custom server and it's not available anymore in getServerSideProps.

@nicholasgriffintn
Copy link

FYI: looks like another issue was made for this: #54440

@balazsorban44
Copy link
Member

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

@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
Projects
None yet
Development

No branches or pull requests

4 participants