What version of Elysia is running?
1.2.6+
What platform is your computer?
every platform
What environment are you using
bun 1.3.2
Are you using dynamic mode?
no
What steps can reproduce the bug?
had some serious head banging for this
import { Elysia } from 'elysia'
async function handle({ cookie, request }: { cookie: any }) {
console.log('cookie:', cookie) // undefined
console.log('cookie in header:', request.headers) // not undefined
return cookie
}
new Elysia()
.get('/repro', async (ctx) => {
// ctx.cookie is never referenced textually in THIS function's
// literal source, so Elysia's static analysis (isFnUse) does not
// detect cookie usage and skips constructing the cookie jar.
return await handle(ctx)
})
.listen(3000)
Compare with:
new Elysia()
.get('/works', async (ctx) => {
void ctx.cookie // <-- merely referencing it here fixes it
return await handle(ctx)
})
.listen(3000)
What is the expected behavior?
Please at least leave this example in your documentation to prevent cotchas
What do you see instead?
No response
Additional information
No response
Have you try removing the node_modules and bun.lock and try again yet?
No response
What version of Elysia is running?
1.2.6+
What platform is your computer?
every platform
What environment are you using
bun 1.3.2
Are you using dynamic mode?
no
What steps can reproduce the bug?
had some serious head banging for this
Compare with:
What is the expected behavior?
Please at least leave this example in your documentation to prevent cotchas
What do you see instead?
No response
Additional information
No response
Have you try removing the
node_modulesandbun.lockand try again yet?No response