Hono

H

Hono

This is the official Hono discord server for the community

Join

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

How to set "credentials: true" in client side using rpc?

I'm using rpc with react query on the client side, this kind of fetching has already credentials: true?
No description

Cookies doesn't process

When I try to run in my middleware the following ``` setCookie(c, 'test', 'res', { maxAge: 60 * 60 * 24 * 7, httpOnly: true }) console.log(getCookie(c, 'test'));...

use Context to get vars from wrangler.toml

how can fix this code. i want to use my openaiApiKey from the wrangler.toml when i create an openai instance. but i cannot use the context . how can i fix it ?
No description

Connect Hono Cloudflare with MongoDB

Hi. I am using Hono and deploying to Cloudflare. However I am unable to find a way to connect mongodb database using mongoose