Hono

H

Hono

This is the official Hono discord server for the community

Join

Hono with Node

How to get the .env variables from the context in hono with the node tamplate?

Websockets

Am I missing something I got this error and I don't found how to fix it with the doc (screenshot from hono node module) I also checked if my setup was correct and it was like this (screenshot where we see initsocket())...
No description

Any way to modify the request path in middleware?

(this is cross-posted on https://github.com/orgs/honojs/discussions/2642 - I'm not quite sure which forum we are meant to use? trying both, apologies for the noise) I am trying to replicate a legacy API which had optional versions in paths, so GET /v1/foo actually called GET /foo under the covers. I was hoping to add some middleware that just intercepted paths starting with /v1 and removed the prefix (or re-directed somehow to the correct route) - but it seems that modifying the ctx.req.path does nothing....

Handling promises resolvers with an in-memory `Map` object

Hello folks, I am developing an app that's using a structure similar to the one in the attached index.ts file. The project I'm building requires starting a request from one client and "confirming" the request from another client. This means that client A must reach out to the /hello-request endpoint, and client B must use /hello-confirm/:helloId to resolve the request. This also works under the assumption that client B would be sent the helloId value in a separate step....

zValidator middleware custom hook

Hi! Iam trying to create a custom error message for my validator, I am using "query" works fine, the data is there but the data isn't being passed to the next function in the chain, resulting in errors because q becomes undefined. Hope someone can help me ```ts const errorHandler: Hook<Record<string, unknown>, Env, string, {}> = async (result, c) =>{...

Setting up Client Components

I'm trying to setup a simple counter client component, code can be seen below. Code is minimal so it's easy to test it (first time using client components on hono) When using the example given in the docs, an "obvious" error that document is not defined would happen, since I'm in the server. Code: ...

Seeking Guidance: Transitioning from Hono.js with Cloudflare Workers to AWS Lambda

Hello, guys! Does anyone have a project that combines Hono.js with AWS Lambda? Please share it here. It would be helpful for me to work with this tech stack. I have worked with Hono.js and Cloudflare Workers, and it's really fast. However, some npm packages do not support edge computing. Therefore, I am planning to switch my upcoming project to AWS. ( hono js + aws lambda ) However, due to the lack of documentation, I am unable to work with Hono.js on AWS Lambda, and there is no option to run the server locally. ...

How do I properly serve static files (generated by Astro)?

I'm trying to serve files built by Astro along with their imports. Currently only the html files without imports get served. For example, http://localhost:3000/_astro/headerBg.C9Twm_Bk.png returns 404. Here's my project structure:...

When there's an error on my typescript code on Hono, Vite Dev Server crashes, and doesn't restart

Problem: - Error? Crash the dev server and not wait for file changes. Ideal experience: - Error? Say it's an error and wait for file changes....

How to implement Oauth in Hono?

I am a beginner. I have used next-auth in next js. Is there a way to implement google Oauth in hono? Code and youtube videos are appreciated. Is there any library i can use?

Failed to load .env file ".env": Error: ENOENT: no such file or directory

Hey, Im new to using cloudflare and new to using Hono. I now came across an error that tells me Im missing a .env file, which also should contain some variables. The problem is, idk where I use these and what their values should be. It seems like these should be using system variables instead (Im currently on Windows 10), but I could find an answer online. This only started appearing after I added and tried using Hono. Here is my code: ```typescript import { Hono } from "hono";...

executionCtx.waitUntil on write service

I have a worker that I want to call an external api on, but I want to return a response without awaiting the the external api call. (the external api call is to just save time writing to the db on another service). ```javascript const promise = fetch('http://localhost:3000/impression', { method: "POST", body: JSON.stringify(data),...

Does Hono JSX do client-side hydration?

I.e. are client events like on:click meant to work? And if not, how can it be enabled / done in other ways?

StreamSSE on http2

Hi ! It seems that the streamSSE feature is not correctly adapted to work on http2. It adds the following header ‘transfer-encoding’->‘chuncked’, which is not authorised on http2. ```js var streamSSE = (c, cb, onError) => { const { readable, writable } = new TransformStream(); const stream = new SSEStreamingApi(writable, readable);...

Optional params in hono/client

It seems that it doesn't support optional params at all. In hono I can specify optional parameters, but in hono/client this is not supported. If I have a route with /:idOrSlug?/invite, then it will match /invite and /:idOrSlug/invite. And if I insert the correct value for the hono client then everything will work, but if it is undefined it will just put the undefined value in the url as shown in the screenshot above....
No description

Send data to Hono

Hi, how can i send Request body and file on same route.

Client ip

How can I get the client ip, I need it for my rate limiter

What is the best way to handle the error?

What I want is to get the error from server to client using rpc + react query 1. Using trycatch 2. Returning c.json({ message: 'Invalid password' }, 401) 3. Throwing HTTPException(401, { message: 'Invalid password' })...
No description

Running `bun run dev` on a newly created Cloudflare Pages example spits an error

``` bun run dev $ vite (!) Could not auto-determine entry point from rollupOptions or html files and there are no explicit optimizeDeps.include patterns. Skipping dependency pre-bundling. error when starting dev server:...

connect my hono application endpoints with swagger ui

how i can use swagger ui with my hono application