You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug: Cookie with max_age=0 is serialized without Max-Age, so it is not deleted #8487
Expected Behaviour: Cookie(name="session", value="", max_age=0) should serialize with Max-Age=0, so the browser deletes the cookie (RFC 6265 section 5.2.2). A negative max_age already does this.
Current Behaviour: max_age=0 produces no Max-Age attribute at all. The browser stores the result as a session cookie instead of deleting it, so a logout handler that clears a cookie with max_age=0 does not remove it.
Possible Solution: Cookie.__str__ checks if self.max_age:, and 0 is falsy. Check if self.max_age is not None: instead; the inner branch already writes Max-Age=0 for zero and negative values.
Steps to Reproduce:
Run the snippet above on develop or 3.35.0.
Powertools for AWS Lambda (Python) version: 3.35.0
AWS Lambda function runtime: 3.12
Packaging format used: PyPi
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
powertools-for-aws-oss-automation commentedon Sep 26, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out our GitHub Discussions: Join the conversation
powertools-for-aws-oss-automation commentedon Sep 28, 2026
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Oct 22, 2026
This is now released under 3.37.0 version!