Description
What version of Elysia is running?
1.3.4
What platform is your computer?
Linux 5.15.167.4-microsoft-standard-WSL2 x86_64 x86_64, bun 1.2.15. Also tested on Linux lolo-vostro 6.12.29 #1-NixOS SMP PREEMPT_DYNAMIC Sun May 18 06:25:00 UTC 2025 x86_64 GNU/Linux with bun 1.2.13
What steps can reproduce the bug?
index.ts
:
import { Elysia, t } from "elysia";
const app = new Elysia()
.guard(({
query: t.Object({ a: t.String() }),
}))
.get("/works", ({ query }) => "Works")
.get("/works-too", (c) => "Works" + c.query)
.get("/works-too-too", (c) => "Works" + c.query.a)
.get("/works-too-too-too", (c) => {
c.query;
return "Works";
})
.get("/broken", () => "Broken")
.get("/broken-too", (c) => "Broken" + c.path)
.get("/broken-too-too", ({ path }) => "Broken" + path)
.listen(3000);
console.log(
`🦊 Elysia is running at ${app.server?.hostname}:${app.server?.port}`
);
What is the expected behavior?
All of the routes work and behave the same apart from the exact response
What do you see instead?
curl 'http://localhost:3000/works'
-> ...validation error
curl 'http://localhost:3000/works?a=text'
-> Works
All of /works* routes behave as expected
curl 'http://localhost:3000/broken'
-> undefined is not an object (evaluating 'c.url.slice')
curl 'http://localhost:3000/broken?a=text'
-> undefined is not an object (evaluating 'c.url.slice')
All of /broken* routes respond with the same exact undefined is not an object (evaluating 'c.url.slice')
Additional information
The full error is:
2 | function anonymous(hooks
3 | ) {
4 | "use strict";
5 | const {handler,handleError,hooks:e, validator,mapResponse,mapCompactResponse,mapEarlyResponse,isNotEmpty,utils:{parseQueryFromURL,},error:{ValidationError,},validateFileExtension,schema,definitions,ERROR_CODE,decodeURIComponent,ElysiaCustomStatusResponse,TypeBoxError}=hooks
6 | return function handle(c){try{if(c.qi!==-1){let url='&'+c.url.slice(c.qi+1)
^
TypeError: undefined is not an object (evaluating 'c.url.slice')
at handle (file:///home/lolotronop/code/elysiabugtest/node_modules/elysia/dist/bun/index.js:6:62)
at map (file:///home/lolotronop/code/elysiabugtest/node_modules/elysia/dist/bun/index.js:4:38
Have you try removing the node_modules
and bun.lockb
and try again yet?
yes, also cleared the bun cache before reinstalling with rm -rf ~/.bun/install/cache/*