Skip to content

Cookie validation and handler issues in Elysia.js #1451

@ShejanMahamud

Description

@ShejanMahamud

What version of Elysia is running?

1.4.9

What platform is your computer?

Linux 6.14.0-29-generic x86_64 x86_64

What environment are you using

bun --version

Are you using dynamic mode?

No response

What steps can reproduce the bug?

  • Send requests with optional cookies or cookies that fail custom validation.
  • Observe incorrect status codes or validation errors.
  • Inspect cookie configs and afterHandle behavior.

What is the expected behavior?

  • Cookies should validate correctly according to their schema.
  • Application-level cookie configs should be applied.
  • AfterHandle loops should execute efficiently.
  • Error handlers should correctly await promises.

What do you see instead?

  • Cookies failing validation even when noValidate: true is set.
  • Application-level cookie settings not applied.
  • Redundant assignments in afterHandle loop.
  • Error responses may not resolve correctly for async handlers.

Additional information

  • Affects src/compose.ts in the composeHandler function.
  • Relevant lines: 1493-1535 (Cookie Validator), 1617-1624 (afterHandle loop), 1939 (error handler promise handling).
  • PR can fix all issues together: correct cookie validation, merge app config, optimize afterHandle, and fix error promise.

Have you try removing the node_modules and bun.lockb and try again yet?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions