[Better Auth]: Error 4816

I am using simple setup for better-auth trying it with Bun.serve. const server = Bun.serve({ fetch: auth.handler, port: 3000, }) export const auth = betterAuth({ plugins: [ openAPI() ], database: drizzleAdapter(db, { provider: "sqlite", }), }) Everything works ok. Just wondering if it's oke to throw error in log like this when we hit url that doesn't exist in better-auth. Server is running on http://localhost:3000/ 2025-04-24T14:36:24.970Z ERROR [Better Auth]: Error 4816 | continue; 4817 | } 4818 | if (endpoint.options?.metadata?.SERVER_ONLY) continue; 4819 | const methods = Array.isArray(endpoint.options?.method) ? endpoint.options.method : [endpoint.options?.method]; 4820 | for (const method of methods) { 4821 | addRoute(router, method, endpoint.path, endpoint);
6 Replies
Artifex
Artifex6mo ago
Hi i'm also encountering this error, i can't seem to figure out the solution
Philip Dziubinsky
happens to me as well when trying to access unknown routes
ssan
ssan5mo ago
i'm having the same problem. it was working fine before. this made my swagger docs break on second refresh
Amirreza
Amirreza5mo ago
same.
adrichut
adrichut4mo ago
has anyone found a solution ?
Ping
Ping4mo ago
The issue exists because of the request calling an endpoint that isn't a better-auth endpoint. The error shouldn't occur if you were to test something like http://localhost:3000/api/auth/get-session Side note: the error number 4816 is actually just the line number the error occurred at, not a real error code.

Did you find this page helpful?