diff --git a/.changeset/make-http-exception.md b/.changeset/make-http-exception.md new file mode 100644 index 00000000..f3ae9fdd --- /dev/null +++ b/.changeset/make-http-exception.md @@ -0,0 +1,5 @@ +--- +'@hono/firebase-auth': patch +--- + +fixed to make HTTPException instead of reponse null \ No newline at end of file diff --git a/packages/firebase-auth/src/index.ts b/packages/firebase-auth/src/index.ts index b0dc335e..c4b56503 100644 --- a/packages/firebase-auth/src/index.ts +++ b/packages/firebase-auth/src/index.ts @@ -1,6 +1,7 @@ import type { KeyStorer, FirebaseIdToken } from 'firebase-auth-cloudflare-workers' import { Auth, WorkersKVStoreSingle } from 'firebase-auth-cloudflare-workers' import type { Context, MiddlewareHandler } from 'hono' +import { HTTPException } from 'hono/http-exception' export type VerifyFirebaseAuthEnv = { PUBLIC_JWK_CACHE_KEY?: string | undefined @@ -61,9 +62,11 @@ export const verifyFirebaseAuth = (userConfig: VerifyFirebaseAuthConfig): Middle err, }) } - return new Response(null, { + + const res = new Response('Unauthorized', { status: 401, }) + throw new HTTPException(401, { res }) } await next() }