Skip to content

Set-Cookie not sent to client when Error() on handler #1547

@lucamoroz

Description

@lucamoroz

What version of Elysia is running?

1.4.15

What platform is your computer?

Linux 6.14.0-114036-tuxedo x86_64 x86_64

What environment are you using

1.3.2

Are you using dynamic mode?

No

What steps can reproduce the bug?

Consider this route:

    .get("/test", async ({cookie}) => {
        cookie.test.value = "a-value";
        throw new Error("test error");
    })

The Set-Cookie header is not sent to the client due to the error thrown.

This happens on response validation erros too.

What is the expected behavior?

The Set-Cookie should be sent anyway.

What do you see instead?

The Set-Cookie header is not sent to the client due to the error thrown.

Additional information

For example, I am rotating the session cookie by revoking the previous session id and setting a new session id, but in case of unexpected errors the new session id is not sent to the user and therefore the session is ended.

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