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

fix(aws-lambda): handle multiple cookies in streaming responses #2926

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

KnisterPeter
Copy link
Contributor

This fix does address that cookies have to be handled
specially in lambda responses.

Fixes #2921

This fix does address that cookies have to be handled
specially in lambda responses.

Fixes honojs#2921
@KnisterPeter KnisterPeter marked this pull request as ready for review June 6, 2024 14:49
@KnisterPeter
Copy link
Contributor Author

It fails in the coverage check because of some GitHub rate-limit. 😿

Copy link

codecov bot commented Jun 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.73%. Comparing base (cb55866) to head (d750253).
Report is 16 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2926      +/-   ##
==========================================
+ Coverage   94.11%   94.73%   +0.62%     
==========================================
  Files         136      136              
  Lines       13382    13335      -47     
  Branches     2347     2261      -86     
==========================================
+ Hits        12594    12633      +39     
+ Misses        788      702      -86     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

// Check content type
const httpResponseMetadata = {
statusCode: res.status,
headers: Object.fromEntries(res.headers.entries()),
headers,
cookies,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KnisterPeter
Copy link
Contributor Author

@watany-dev Any chance to get this merged?

@KnisterPeter
Copy link
Contributor Author

@yusukebe @usualoma Can you share an update on this bugfix? Will it be able to get merged? If not what do I need to provide to have it fixed?

@yusukebe
Copy link
Member

@KnisterPeter

Sorry for not responding to you! It seems to be good. But if you can, can you write a unit test?

@KnisterPeter
Copy link
Contributor Author

@yusukebe I would love to, unfortunately I cannot figure out how the streamHandle tests does work.
For me they are failing while accessing awslambda.HttpResponseStream.from. It does not exist in the lambda streaming mock.
Any hint?

Btw: The tests are not failing but stacktraces in the test output are printed.

@yusukebe yusukebe changed the title fix: handle multiple cookies in streaming responses fix(aws-lambda): handle multiple cookies in streaming responses Jun 11, 2024
@yusukebe
Copy link
Member

@watany-dev Do you have any ideas for testing streamHandle?

@KnisterPeter
Copy link
Contributor Author

@yusukebe Found a way to test the cookies (and other headers) in the stream. Can you accept that solution?

@KnisterPeter
Copy link
Contributor Author

@yusukebe What else can I do to get this merged?

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe
Copy link
Member

@KnisterPeter

Sorry for my late reply. This is great! I appreciate you added the test. Let's go with it. I'll merge it and release a minor version, including it later. Thanks.

@yusukebe yusukebe merged commit a2a04a9 into honojs:main Jun 12, 2024
14 checks passed
@KnisterPeter KnisterPeter deleted the multiple-cookies branch June 12, 2024 13:39
@KnisterPeter
Copy link
Contributor Author

Hi @yusukebe, can you do a minor release with this patch? We are seeing this issue and waiting for a fix.

@yusukebe
Copy link
Member

@KnisterPeter

I've released the 4.4.6 which includes this fix now! Thanks!

NamesMT added a commit to NamesMT/hono-adapter-aws-lambda that referenced this pull request Jun 17, 2024
nicolewhite referenced this pull request in autoblocksai/cli Jun 24, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [hono](https://hono.dev/) ([source](https://github.com/honojs/hono))
| [`4.4.4` ->
`4.4.7`](https://renovatebot.com/diffs/npm/hono/4.4.4/4.4.7) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/hono/4.4.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/hono/4.4.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/hono/4.4.4/4.4.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/hono/4.4.4/4.4.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>honojs/hono (hono)</summary>

### [`v4.4.7`](https://github.com/honojs/hono/releases/tag/v4.4.7)

[Compare
Source](https://github.com/honojs/hono/compare/v4.4.6...v4.4.7)

#### What's Changed

- use correct return type for c.html depending on input by
[@&#8203;asmadsen](https://github.com/asmadsen) in
[https://github.com/honojs/hono/pull/2973](https://github.com/honojs/hono/pull/2973)
- test: test uncovered return statement by
[@&#8203;yasuaki640](https://github.com/yasuaki640) in
[https://github.com/honojs/hono/pull/2985](https://github.com/honojs/hono/pull/2985)
- test: Update request.test.ts to remove duplicate checks by
[@&#8203;JoaquimLey](https://github.com/JoaquimLey) in
[https://github.com/honojs/hono/pull/2984](https://github.com/honojs/hono/pull/2984)
- fix(types): env variables override ContextVariableMap by
[@&#8203;KaelWD](https://github.com/KaelWD) in
[https://github.com/honojs/hono/pull/2987](https://github.com/honojs/hono/pull/2987)

#### New Contributors

- [@&#8203;asmadsen](https://github.com/asmadsen) made their first
contribution in
[https://github.com/honojs/hono/pull/2973](https://github.com/honojs/hono/pull/2973)
- [@&#8203;JoaquimLey](https://github.com/JoaquimLey) made their first
contribution in
[https://github.com/honojs/hono/pull/2984](https://github.com/honojs/hono/pull/2984)
- [@&#8203;KaelWD](https://github.com/KaelWD) made their first
contribution in
[https://github.com/honojs/hono/pull/2987](https://github.com/honojs/hono/pull/2987)

**Full Changelog**:
honojs/hono@v4.4.6...v4.4.7

### [`v4.4.6`](https://github.com/honojs/hono/releases/tag/v4.4.6)

[Compare
Source](https://github.com/honojs/hono/compare/v4.4.5...v4.4.6)

##### What's Changed

- fix(aws-lambda): handle multiple cookies in streaming responses by
[@&#8203;KnisterPeter](https://github.com/KnisterPeter) in
[https://github.com/honojs/hono/pull/2926](https://github.com/honojs/hono/pull/2926)

**Full Changelog**:
honojs/hono@v4.4.5...v4.4.6

### [`v4.4.5`](https://github.com/honojs/hono/releases/tag/v4.4.5)

[Compare
Source](https://github.com/honojs/hono/compare/v4.4.4...v4.4.5)

##### What's Changed

- fix(cors): allow custom vary header by
[@&#8203;fzn0x](https://github.com/fzn0x) in
[https://github.com/honojs/hono/pull/2934](https://github.com/honojs/hono/pull/2934)
- fix(jsx): rename `Hono` to `JSX` and export `JSX` namespace by
[@&#8203;yusukebe](https://github.com/yusukebe) in
[https://github.com/honojs/hono/pull/2937](https://github.com/honojs/hono/pull/2937)
- refactor(hono-base): make 2nd arg of `app.route()` required by
[@&#8203;yusukebe](https://github.com/yusukebe) in
[https://github.com/honojs/hono/pull/2945](https://github.com/honojs/hono/pull/2945)
- refactor(hono-base): don't check 1st argument of `app.on()` by
[@&#8203;yusukebe](https://github.com/yusukebe) in
[https://github.com/honojs/hono/pull/2946](https://github.com/honojs/hono/pull/2946)
- refactor(context): remove unnecessary initialization add add tests for
Context by [@&#8203;yusukebe](https://github.com/yusukebe) in
[https://github.com/honojs/hono/pull/2949](https://github.com/honojs/hono/pull/2949)
- test(hono-base): add tests for covering 100% by
[@&#8203;yusukebe](https://github.com/yusukebe) in
[https://github.com/honojs/hono/pull/2952](https://github.com/honojs/hono/pull/2952)
- fix(context): default JSONRespond and TextRespond StatusCode generic
arg by [@&#8203;EdamAme-x](https://github.com/EdamAme-x) in
[https://github.com/honojs/hono/pull/2954](https://github.com/honojs/hono/pull/2954)
- refactor(request): shorten `parseBody` and remove unnecessary check by
[@&#8203;yusukebe](https://github.com/yusukebe) in
[https://github.com/honojs/hono/pull/2947](https://github.com/honojs/hono/pull/2947)
- refactor(jsx): reduce code size and improve maintainability by
[@&#8203;usualoma](https://github.com/usualoma) in
[https://github.com/honojs/hono/pull/2956](https://github.com/honojs/hono/pull/2956)

**Full Changelog**:
honojs/hono@v4.4.4...v4.4.5

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on Monday" in timezone
America/Chicago, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/autoblocksai/cli).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjQxMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setting multiple cookies at once does not work using lambda streamHandle
3 participants