Hono

H

Hono

This is the official Hono discord server for the community

Join

event.pathParameters not populated on AWS Lambda event object

I have an existing AWS Lambda + API Gateway application that I am moving onto Hono. Here is my basic code: ``` type Bindings = {...

Trace when body is consumed

I have a middleware that's basically ```js if (cache.has(key)) { return cache.get(key).clone() }...

Creating custom webhooks

Hello, I'm trying to figure out how to create custom webhooks in Hono. I couldn't find any documentation on this topic. Does anyone have any direction? I have a long running function at one of my endpoints and want to allow users to subscribe to this endpoint and be told when it's done. This is achievable in Hono, right?

How to keep SSE alive with PSQL?

I have a PSQL client and I wish to send the logs via SSE. I am using the LISTEN/NOTIFY syntax where I can attach handlers to the client.on('notification'). As I understand it from the docs, I need to have a while loop to keep the connection alive, but at the same time, this code causes infinite listeners on postgres (which errors). How can I do this?...
No description

Recommendation on libraries for relatively small project

I am new to Hono and CFW. I want to use Cloudflare workers with Hono to convert an old website I wrote many years ago in Classic ASP to a modern framework as a learning exercise. After that, I have some other .NET apps I want to convert. But, I'm stuck on some basics. Using ChatGPT I got a basic API working with Hono and Workers. But to my surprise, serving static content is not straight forward. I want to keep my project as simple as possible, but it seems i need to setup Cloudflare pages as well. I want to be able manage the static content and Worker code in the same project. I also want to use templates for the HTML content. I'm familiar with Handlebars but I'm not sure that's ideal here. I want to use whatever is best and lightweight/fastest for my project....

server static file + caching

Hey guys, I am serving a static folder called public and it's all working well, I can access my files, eg styles.css. Here is the code for it: ```ts...

doc endpoint returns 500 with no errors in logs

I am running on Lambda. I have used ts-to-zod to convert some of my types to zod definitions. I have the following code: ``` const app = new OpenAPIHono<{ Bindings: Bindings }>(); app.use("*", cors());...

Bun + Hono doesn't work for me.

Hi, folks. Wanted to try hono with bun, but wasn't successful. I tried to fix it by myself with google and chatgpt, but also wasn't succesful. May I ask you folks to help? ``` bun -v 1.1.26 āžœ bun create hono hono_test ...

How to work with node:cluster in Bun?

I tried to test hono with node:cluster module that has just been added to Bun v1.2.25 Here are my scripts: server.js ```js...

how to use with hono WorkerEntrypoint

Hi, I'm using hono and cloudflare workers. I'm using 3 workers and I'd like to communicate with a 4th one that acts as a gateway, that is, that validates the token and redirects the requests to their respective workers. According to the cloudflare workers documentation, this should be done using service binding plus RPC so that they are private, but I don't know how to adapt it to hono. according to the documentation it should be like this ```js import { WorkerEntrypoint } from "cloudflare:workers";...

Email Templates

Hello, anyone tried creating email templates in hono? I tried react-email however I had no luck as it shows a lot of errors. Anything that could help is much appreciated. Thank you!
No description

Argument type string is not assignable to parameter type keyof E["Variables"]

I'm using Hono with Webstorm and whenever I use .get() or .set() with some key of string, webstorm will always complain such type mismatch. Even the type-safe guard on docs doesn't help. The code: https://github.com/search?q=repo%3Aminhperry%2Fcf-worker-backend%20c.get(&type=code...
No description

Cloudflare KV not inserting values

Why doesn't this ADD the user to the KV namespace?. Using cloudflare pages
No description

Knex + Hono + Bun Connection Errors

I was using knex on bun+hono and was attempting to make a connection via the following syntax ``` import { Knex, knex } from 'knex'; import pg from 'pg';...

Middleware errors are not being returned in response type

I have a user route using an auth middleware, ```ts export const usersRouter = new Hono() .use(authorize) .get('/', async (c) => {...

Hono SSE Stream Closing Unexpectedly After 10 Seconds

Title: Hono SSE Stream Closing After 10 Seconds Issue: Using Hono's streamSSE, the SSE connection closes after ~10 seconds, regardless of client (curl/browser). A minimal Node.js SSE server works fine. Environment: Debian, localhost...

Combine SSR and Client Components without HonoX

What's the prefered way to have these two working together with syntaxic coloration and no raw html in one color in my VS Code editor? SSR: https://hono.dev/docs/guides/jsx Client side: https://hono.dev/docs/guides/jsx-dom...
No description

How do I serve hono on https

Hello I'm using Hono with Bun, and I would like to serve the the application on https://localhost:3000, I couldn't find any documentation on this. Any help would be greatly appreciated šŸ™‚...

Enforcing strict types for Hono's c.json() responses?

Is it possible to enforce strict typing for Hono's c.json() responses at a top level (hono.Handler<..>)? Currently, I can define expected response types like this: ```ts type MyResponse = {someType: string};...

Sharing the app type from my hono api to my client in a monorepo

I'm trying to share types between my Hono API and Svelte app. Currently doing this: ```js // Hono app - apps/api/src/index.ts...