Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Mikey-ShenSu opened this issue Mar 27, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Mikey-ShenSu
Copy link

Mikey-ShenSu commented Mar 27, 2024

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

@Mikey-ShenSu Mikey-ShenSu added the bug Something isn't working label Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant