-
-
Notifications
You must be signed in to change notification settings - Fork 494
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.4.7
What platform is your computer?
Darwin 24.6.0 arm64 arm
What environment are you using
Bun 1.1.20
Are you using dynamic mode?
No
What steps can reproduce the bug?
I'm using Better Auth and have noticed that during the lifecycle hooks I am getting the incorrect HTTP status in the set object
The response and responseValue that comes back from the Better Auth handler is correct, but it's being mapped to a 200 no matter the response status
{
request: Request (69 bytes) {
method: "POST",
url: "http://localhost:3001/auth/api/sign-in/email",
headers: Headers {...
ReadableStream {...}
},
store: {
startTime: 414435.075333,
endTime: 414594.388708,
responseTime: 159.313375000027,
},
qi: -1,
path: "/auth/api/sign-in/email",
url: "http://localhost:3001/auth/api/sign-in/email",
redirect: [Function: redirect],
status: [Function: status],
set: {
headers: {...,
status: 200, <<<<<<<<<<< THIS SHOULD BE 401
cookie: {},
},
server: [Getter],
params: {
"*": "api/sign-in/email",
},
headers: {...},
cookie: {...},
query: [Object: null prototype] {},
route: "/auth/*",
log: undefined,
responseValue: Response (0 KB) {
ok: false,
url: "",
status: 401, <<<<<<<<<< THIS IS 401
statusText: "UNAUTHORIZED",
headers: Headers {},
redirected: false,
bodyUsed: true
},
response: Response (0 KB) {
ok: false,
url: "",
status: 401, <<<<<<<<<< THIS IS 401
statusText: "UNAUTHORIZED",
headers: Headers {},
redirected: false,
bodyUsed: true
},
}const app = new Elysia()
.onAfterResponse({ as: "global" }, (ctx) => {
console.log(ctx);
});The handler returns the correct status to the browser though
What is the expected behavior?
The set.status should match the response and responseValue status
What do you see instead?
set.status returns 200 no matter the responseValue/response
Additional information
No response
Have you try removing the node_modules and bun.lockb and try again yet?
yes
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working