Hono

H

Hono

This is the official Hono discord server for the community

Join

Does the context object get shared across all sessions?

I am using hono-sessions. I have several different users. Am I correct in assuming that each invocation in hono shares 1 context object ... so if I store something directly using context.set(x, y) it will be shared by every route?

middleware on a router level

Right now, i have this setup, where canExperiment is also a middleware: ```javascript export const statisticsRouter = new Hono(); statisticsRouter.get('/monitor', monitorHandler);...

Hono and 3rd party middleware on Deno

Hi, I use Hono and 3rd party middleware on Deno. I import them with npm / esm. Is there a better way to link dependencies with hono ? Does porting them on jsr will help ?...

Can't get webhook path to work

Whenever clerk fires a user_updated | user_created event I want to catch in on /webhook/clerk/user-updated path using hono routing. I get 404 everytime clerk fires that event. However, if I look at the typeof routes I see that I have /webhook/clerk/user-updated/$post I don't get it why the route is not accessible from the outside. This is my index.ts ```...

hono-sessions not sharing state between routes.

Hi was just working through hello world login/logout scenario but cannot seem to get the state shared between different routes created in separate files?

Hot reload not working? (BUN)

I try to setup the @hono/vite-dev-server with the default setup vite.config.ts ```ts import { defineConfig } from "vite";...

Node.js does not work in Next.js

My hono implementation works fine on edge in Next.js. But, I am getting the following error when migrating from edge (hono/vercel) to nodejs (@hono/node-server/vercel). ```ts ⨯ TypeError: outgoing.writeHead is not a function at responseViaResponseObject (webpack-internal:///(rsc)/./node_modules/@hono/node-server/dist/vercel.mjs:373:14)...

Is it possible to return only an image / file?

I know in Node.js you can use a function on the response called res.sendFile. I was curious if Hono has anything similar?

[solved] HtmlEscapedString not rendering?

When I have this function ``` import { HtmlEscapedString } from 'hono/utils/html' ...

validating arrays coming from forms

The following code works ``` <form action='?'...

[solved] return type of request handler

Why is 1) is fine and 2) has a type problem? 1) ```...

[solved] route param validation with zod

``` .delete('/foo/:id', zValidator('param', z.object({ id: z.number() })), async (c) => { const { id } = c.req.valid('param')...

Having middleware routes in RPC

Hi, I'm setting up honojs as the API of a SPA, with authjs as authentication library using the honojs middleware (https://github.com/honojs/middleware/tree/main/packages/auth-js) I have the auth and RPC setup in the following way ```JS app.use('/auth/*', authHandler());...

Importing AppType to client defaults output to any types

Hi, I just started using Hono yesterday and I'm loving it, but I'm facing an issue where, when I import AppType to the client, the types for output default to the Any type. I'm currently stumped on why this happens. Client src: /packages/frontend/src/lib/apis/images/index.ts ```typescript import type { AppType } from "@tavern/functions/src/stableDiffusion";...

How to use handlebars or pug in honojs?

Hi, i'm want to use view engine (like handlebars and pug ) in honojs. Is there any way to use it?

How to handle multiple errors in (react query) using (hono rpc)?

How can I handle multiple errors like in my case? I want to display the error on my signup form layout....

Type 'Hono<App {...}>' does not satisfy the constraint 'Hono<any, any, any> Property '#private' in t

Hi, I'm trying to use hono RPC client on my frontend project. But the type not working properly. I'm using "hono": "^4.3.7", on server and client. // On /web-api/src/routes/index.ts [Server] ```js import { App } from "@/@types/app";...

Is it safe to store user data with set/get?

I read (https://github.com/honojs/hono/issues/585#issuecomment-1826189093) that context state can be shared if the request is handled by the same worker. Is it safe to store user/session data with set/get?

ContextVariableMap not recognized during build from other package in monorepo

I created src/hodo.d.ts file in my Hono project: ```ts import { User } from './schema'; declare module 'hono' {...

Is there a way to subscribe/publish with Hono webSocket middleware (for Bun)?

I am definitely far from familiarity with websockets but I am excited to try it out with Hono. I am just testing it out trying to build a basic chat application with rooms based on a URL but for some reason I can only get the websockets to publish to an individual session and not for multiple users on different browsers. I see there is a ‘raw’ object on the websocket object that has subscribe and publish but the publish doesn’t seem to broadcast the message. I am totally open to additional docs...