Hono

H

Hono

This is the official Hono discord server for the community

Join

ctx.req: readable stream

noticed there's documentation for sending a steam, but having difficulty reading one from the Context

Module not found: Can't resolve 'path' with Hono Drizzle

The Error
./node_modules/dotenv/lib/main.js:2:1
Module not found: Can't resolve 'path'
./node_modules/dotenv/lib/main.js:2:1
Module not found: Can't resolve 'path'
...

unable to retrieve cookie value

```ts // index.ts import { Hono } from 'hono'; import { getCookie, setCookie} from 'hono/cookie'; import CryptoJS from 'crypto-js';...

Posting files in multipart/form-data gives empty string

Hey everyone. I've run into a problem where when I try to upload a file to my hono application as multipart/form-data all I get back is an empty string. In my form I am sending a key of name expected to be a string and image expected to be a file....
No description

[zod, bun]#openapi async/await doesn't work

This ossue was previously on https://discord.com/channels/1011308539819597844/1012485912409690122/1242558525012709539, but I was advised to open it here. here is a noob question. Im quite new to TS, bun and Hono with Zod. I cant make sense of why TS is screaming at me in the first line with async ```ts apps.openapi(routeGetApp, async (c) => {...

where cookies??? where res?

Hi everyone, I'm not using cookies at all, or trying to mess with the headers myself and am getting this error in a POST handler: [NOTE]: i'm porting this from express to hono and the logic hasn't changed and this has been working forever (in express) [ALSO]: the user is created in the database, the email is sent and received... this is my code:...
No description

How to debug Hono/HonoX in Visual Studio Code?

I always run the code via npm run dev or bun dev. Since I am building a web app in HonoX and most of it is SSR, how can i use the IDE debugger so I can hit breakpoints and etc in Visual Studio Code? Ex: next.js has this guide: https://nextjs.org/docs/pages/building-your-application/configuring/debugging How do I do this for Hono/X?...

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());...