Hono

H

Hono

This is the official Hono discord server for the community

Join

Append Authorization access token to RPC client in asynchronous way (amplify auth/cognito)

Im trying to use RPC but I use AMPLIFY AUTH and i want to append the access token in each rpc clients. ```ts const client = hc<typeof adminApp>(process.env.NEXT_PUBLIC_API_URL!, {...

Infer client openAPI

Hey all, I am wondering about something, I am able to infer the types from hono, in the client side if it's just a normal hono app without openAPI, but the moment i add open api, i do not get any inference, does any one know a workaroud or a way to get inference in the client
No description

Envs not extendable with `createFactory`

When utilizing the createFactory method, middleware is unable to modify or extend any of the types. This seems like a bug/issue as any auth middlware would want to ensure a session/user variable would be defined for type safety. factory.ts ```ts export type HonoEnv = {...
No description

Can app.notFound be customized for each Hono instance?

Hi. I'm experimenting a small application on Node.js 20. I notice that the app.notFound() function is applied globally rather than per Hono instance. For example: ``` import { Hono } from 'hono'; import { serve } from '@hono/node-server';...

Context is not finalized

`` <-- GET / Error: Context is not finalized. Did you forget to return a Response object or await next()`? at file:///workspace/react-router/node_modules/.pnpm/[email protected]/node_modules/hono/dist/hono-base.js:202:17 at getRequestListener.overrideGlobalObjects (file:///workspace/react-router/node_modules/.pnpm/@[email protected][email protected]/node_modules/@hono/vite-dev-server/dist/dev-server.js:78:32)...

Git Autodeploy on Cloudflare

Hi! I've build an API with Hono via Bun + CF Workers. On the docs they have a section where they explain how to make auto-deploys to cloudflare on branch pushes via GitHub Actions. I've seen that cloudflare workers, they now have an option where you can connect to the repository, select the branch, the compilation command and the implementation command. When I deploy the worker from the CLI I use the command "bun run deploy:main" that runs "wrangler deploy --env main --minify src/index.ts". I have setted this last command on the implementation command but It gives an error on the deployment....
No description

Is there any way to mock cookies using testing helpers?

we already have testing helper and cookies helpers in Hono, but I can't find a way to inject cookies. I'm using Lucia with Hono together, they recommend to transfer session by cookies. Is this possible in test environment? if no, I have a worst plan is to create a custom app and takeover routes. and replace cookie middleware with bearer token middleware. how do you think?...

Is there a way to get bindings outside the `c` Context of an inbound Request in Cloudflare Workers?

I'm trying to setup the better-auth with D1 but following the guide it pops out that I need to have a valid reference of my binded D1 database outside of the inbount request context (the c.env). There are other examples of using D1 with better-auth but I can't figure out how to make it work within a Hono app deployed on Cloudflare Workers. ```typescript import { betterAuth } from "better-auth";...

Multipath route parameters in Hono

How can I express a "multipath segments" in Hono? I'm trying to use Hono for the Cloudflare Pages Functions -> Workers transition and I have a route like this: functions/[[app]]/[hash].zip.ts // e.g. /my-app/nested/path/12345.zip // -> app: ["my-app", "nested", "path"]...

Vite plugin does not compile the commonjs module

Hey Team, I am developing an application using Yusuke's template https://github.com/yusukebe/cloudflare-d1-drizzle-honox-starter If you add any library which also comes with commonjs/nodejs module, it fails to load them . Everything works fine with npx wrangler pages dev though. Any idea, agains which repo, should I post this issue on Github...

Pass context to exception handler

Hey, is there a way to pass some context about request to the exception handler via Hono context?

SSR and Client components using Cloudflare pages

Hello, I have been trying to get server-side rendering and client components to work for some time now, but I can't seem to make it function properly. I used the template from bun create hono and selected Cloudflare Pages. While the page gets rendered, it doesn't get hydrated on the client. I have looked into the hono/jsx-dom documentation (https://hono.dev/docs/guides/jsx-dom) and this example (https://github.com/honojs/examples/tree/main/hono-vite-jsx), but I have been unable to use them with a server-side rendered application. Any help would be greatly appreciated!...

Cannot parse action at /api/auth/providers also /api/auth/error (Next Auth .vs Cognito AWS)

Hi, I'm trying to integrate Hono.js with my Next.js App using Auth.js and Cognito AWS. I've follow the example repo here: https://github.com/divyam234/next-auth-hono-react, but it seem to not working as expected. This is my implemented code: // ./api.ts import { Hono } from "hono"; import { authHandler, initAuthConfig, verifyAuth } from "@hono/auth-js";...

Need to generate new css with hash to burst cache

My _renderer.tsx look as below, I wan to generate new .css each time since my css changes are not being reflected on browser - How to do that ( I am using vite)? ``` <html lang="en"> <head> <meta charset="utf-8" />...

hono type definition not working (using hono first time)

Hey, i am new to hono and using it for the first time. Could you pls help in the issue i am facing. I have passed prisma as a variable in hono generic. However when i use prisma in another function, i am not getting its type definition by default??
No description

JSX not working at all with just "bun add hono"

``js const Layout = (props) => html <html> <head> <meta charset="UTF-8">...
No description

honox - not returning anything from POST, gives 404.

Is this expected, if not will log an issue on honox repo.

RPC AppType breaks if route is defined on a separate file

Hello everyone, Im trying to build a Hono backend with a Vite SPA as the frontend Currently the file structure looks like the image attached I (think) Im able to export the correct type from src/app (image) If I try to create the RPC client on the backend (for testing), it works as expected (image)...
No description

Is the request body parsed using a specific encoding?

I got a request holding a some characters small example: Itali\u00eb This was converted as Italië. Is there a way to disable this?...

Using honox, bun, vite and using islands folder, Hot Reload doesn't work

for client side components changes, they do not get reloaded on browser, Am I missing some setting to enable that?
Next