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

[Bug]: Middleware context.response object missing most of it params #5687

Closed
kirillbashtenko opened this issue Apr 25, 2024 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@kirillbashtenko
Copy link
Contributor

版本信息

System:
    OS: macOS 13.5.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 199.65 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 124.0.6367.79
    Safari: 17.4.1
  npmPackages:
    @modern-js/app-tools: 2.49.1 => 2.49.1 
    @modern-js/eslint-config: 2.49.1 => 2.49.1 
    @modern-js/plugin-server: 2.49.1 => 2.49.1 
    @modern-js/runtime: 2.49.1 => 2.49.1 
    @modern-js/tsconfig: 2.49.1 => 2.49.1

问题详情

Hello, it looks like in the latest version, Middleware context.response is missing most of the declared things, we can't set cookies or do anything else.

If you try to console log it this is all that you will see.

{ private_overrided: false, locals: {} }

复现链接

https://github.com/kirillbashtenko/modernjs-middleware-issue

复现步骤

1 pnpm install
2 pnpm start
3 try console.log context.response in middleware

@kirillbashtenko kirillbashtenko added the bug Something isn't working label Apr 25, 2024
@yimingjfe
Copy link
Member

Thanks for your feedback, we have reproduced the issue and will fix it as soon as possible.

@GiveMe-A-Name
Copy link
Member

Got it, we will fix it recently

@GiveMe-A-Name
Copy link
Member

it fixed by #5700

@kirillbashtenko
Copy link
Contributor Author

kirillbashtenko commented May 12, 2024

@GiveMe-A-Name @yimingjfe Unfortunately still reproducible.

PS: Reproduce link updated to 2.49.3 version. Please take a look.

@GiveMe-A-Name
Copy link
Member

@kirillbashtenko
You can set cookie by using context.response.cookie.set(key, value), even though you can't print it.
The context.response is implements like this:

class BaseResponse {
  get cookie() {
    return ..
  }
}

const baseRes = new BaseResponse()

In node.js, we can't print baseRes properties. But the cookie attributes is exists truly.

@kirillbashtenko
Copy link
Contributor Author

@GiveMe-A-Name Indeed, my bad, thank you, i'm closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants