elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.74k stars 207 forks source link

"Cannot read properties of undefined (reading 'authorization')" #574

Closed Mikey-ShenSu closed 1 week ago

Mikey-ShenSu commented 5 months ago

What version of Elysia.JS is running?

^1.0.9

What platform is your computer?

Darwin 23.4.0 arm64 arm

What steps can reproduce the bug?

package.json:

{
"next": "14.1.3",
"@elysiajs/bearer": "^1.0.2"
}

/app/api/[[...slugs]]/route.ts:

import { Elysia, t } from "elysia";
import { bearer } from "@elysiajs/bearer";

const app = new Elysia({ prefix: "/api" })
  .use(bearer())

export const GET = app.handle;
export const POST = app.handle;
export const PUT = app.handle;
export const DELETE = app.handle;

export type API = typeof app;

Bash:

bun run build
bun start

Just by that, you will get the error:

{
    "name": "TypeError",
    "message": "Cannot read properties of undefined (reading 'authorization')"
}

What is the expected behavior?

Should return API response normally.

What do you see instead?

No response

Additional information

Such error would not occur if you are in bun dev

SaltyAom commented 1 week ago

Should have been fixed with #623.

If the problem still persists, feel free to reopen the issue. Thanks.