Hono

H

Hono

This is the official Hono discord server for the community

Join

static files 404 when in subdirectory of assets

Hello, i am using hono with a cloudflare worker to serve the asset folder 'assets' as seen in the examples: ``` <p> Try visiting: <a href="/my-file.txt">/my-file.txt</a> and <a href="/folder/nested-file.txt">/folder/nested-file.txt</a> </p>...

Versions of @hono/zod-openapi >= 0.17 will cause vscode to crash

When I upgraded package @hono/zod-openapi to >= 0.17, vscode's typescript server gets stuck and stays in the state of being loaded with IntelliSense. May I ask what is causing this?

Any lib for API rate limiter in hono CF worker?

I'm looking for something like this: https://www.npmjs.com/package/hono-rate-limit but maintained. Do you know anything? Even some side-code repo would be great...

Closing resources and streaming response

I'm running Hono on node.js and I had a bug the other day, we added an endpoint to our API that was streaming the response back to the client, however we got some weird connection error to our database while the stream was running. In one of our middleware we instanciate a postgres.js connection to the database, and we use this connection to generate streaming data to the client, however to avoid leaking connection we explicitly close the connection at the end of the middleware (I know there are some ways to re-use connection using pooling, but this is not the point here (for info, we are dynamically connecting to many different database depending on where the request is coming from, so we can't easily implement a pooling mecanism on this server). Of course the middleware is running as soon as the response (i.e the beginning of the stream) is send back to the user, which trigger the cleaning of the resource, and a failure of the generator to produce more results in the stream. The following reproducer explains the problems quite well I think:...

How to implement renderToPipeableStream with the streaming API?

```ts return stream(c, async (stream) => { const {pipe} = reactServer.renderToPipeableStream( <></> , {...

Getting isssues on adding data to KV store

Logs [wrangler:inf] POST /api/v1/renewal-reminders 200 OK (33ms) Code: const app = new Hono();...

Use zod schema generated with prisma with @hono/zod-openapi

Is there a way to use already generated zod schema with @hono/zod-openapi ? The Zod schemas generated by Prisma are not enhanced the way @hono/zod-openapi provides. Does anyone know a way to enhance them for use with createRoute from @hono/zod-openapi (request.params, json validator, ...)...

RPC types not working well inside a monorepo

I have a monorepo setup with packages/api for my hono api and app/www for the client code. I have set up rpc well but i am getting Type instantiation is excessively deep and possibly infinite.ts. I have tried the following - I have set strict to true on both my api and client package - have set composite true in my api package and set path reference in my client package. The above two helped to infer the types in the client from unknown to actual types but now its giving the type instantiation error....

Update the default validator to return custom error response

hey guys, I want to update the default zValidator of hono to return custom error objects. Right now, it returns something like this: ```json { "success": false, "error": {...

Get the username using basic auth

```jsx import { Hono } from 'hono' import { basicAuth } from 'hono/basic-auth' const page = new Hono()...

deno: react-pdf pitfall

If you are using deno+hono and react-pdf to create pdfs, do not use the default import like the docs of react-pdf say. Instead of ```typescript import ReactPDF from "@react-pdf/renderer";...
No description

correct type of this `Context`

from here https://hono.dev/docs/middleware/builtin/timeout#usage I tried ```ts context: Context<{ Bindings: Env }>...
No description

Honox scripts and styles not working in production

Hi Guys, Am currently trying to deploy a honox project in Deno deploy. The project is working well in the local machine but when deployed the islands and styles are not working. It might be a path issue but am unsure on how to proceed. _renderer.tsx ```...

Typing nested controlled

Hi, how can I get this param typed? ```typescript import { Hono } from "hono" // reviews controller...

How to handle file uploads

There's a very brief documentation on file upload, however it doesn't cover how to store files on the disk. Of course I could use native Node modules, like fs however my biggest problem is that it's all done in memory. I've also noticed that when using req.parseBody, if there are multiple large size files being uploaded, the server response time for other endpoints increases drastically. So what would be the correct way to handle file uploads, while avoiding storing files in the memory?

products/{id} APIs conflicting with products/my-products in generated doc with OpenAPI

I did put the {id} one after the my-products one, but it doesn't seem to work?
No description

Failed deploy with Hono, Vite and email event handler

I'm building a email disposable service with Cloudflare workers. When I deploy using vite build --mode client && vite build && wrangler deploy --no-bundle I get the error: A request to the Cloudflare API (/accounts/xxx/workers/scripts/disposible-email/versions) failed. Uncaught TypeError: Cannot read properties of undefined (reading 'map') at null.<anonymous> (index.js:1:21247) in route [code: 10021]. I already figured out that the problem lies with export default { fetch: app.fetch, email: async (message, env) => {} because when I export app like export default app the error does not occur. When I use export default { fetch: app.fetch } the error will occur. My entrypoint (index.tsx) looks like this:...

Why Are My Hono RPC Routes Not Showing Beyond $get, $post, and $url?

I have set up RPC in my Hono project and configured my routes as follows. However, when I check the available RPC methods, only $get, $post, and $url appear in the list.
How can I make all the other defined routes accessible through RPC? Here is my current router setup:...
No description

How to pipe the archive in stream hono?

```js const streamPipe = new PassThrough(); archive.pipe(streamPipe); const write = new WritableStream();...

Hono React with bun

Error: ``` Type '(props: Props) => boolean' is not assignable to type 'FC'. Type 'boolean' is not assignable to type 'HtmlEscapedString | Promise<HtmlEscapedString> | null'.ts(2322)...
Next