Hono

H

Hono

This is the official Hono discord server for the community

Join

Using honox client.ts to load web components

I'm using honox client.ts to load web components I created in Lit. It works great but only when I have at least one island on the route. How can I make sure the js is loaded even when I don't have island on the route. I'm using <Script src='/app/client.ts' async /> in my _renderer.tsx file`...

RPC client shows 'any'

Hi, I currently working on getting frontend api with types. But when I do it, it shows `` Element implicitly has an 'any' type because expression of type '":shift_date"' can't be used to index type 'ClientRequest<{ [x: $${Lowercase<string>}]: { input: any; output: any; outputFormat: string; status: StatusCode; }; }>'. Property ':shift_date' does not exist on type 'ClientRequest<{ [x: $${Lowercase<string>}`]: { input: any; output: any; outputFormat: string; status: StatusCode; }; }>'...
No description

Handler type

Hey guys was wondering, what is the best way to implement a RouteHandler like the one present in @hono/zod-openapi based om my code below, I am using hono-openapi for .lazy() and a couple other features

Node Web Sockets in Hono

Hello all, I'm fairly new to Hono and I've recently picked it up for some of my projects and enjoyed it very much. Im currently facing problems with one of my projects that uses WebSockets to communicate with Hardware boxes. And I will need another WebSocket as well to communicate with my frontend and mobile application. I've searched for many solutions online but it looks like Hono with Node WebSockets is rarely talked about....

Types issue in zod-openapi in recent release 0.19.4 (repro attached)

Maybe I'm holding it wrong, but this minimal file reproduces the type error: ```ts import {OpenAPIHono, createRoute, z} from '@hono/zod-openapi' interface AppBindings { Variables: { userId: string } }...

Which Hono Router Should I Use in This Case?

Hono has five different routers: 1. PatternRouter 2. SmartRouter 3. LinearRouter...

zValidator c.req.valid("form") type error

Hey everyone, I am trying to use the zValidator middleware which I have setup in an auth.validator.ts file which looks like: ``` const signUpSchema = z.object({ email: z.string().email("Invalid email address"), password: z...

exemple for zod-openapi + rpc

does anyone has a working exemple of https://hono.dev/examples/zod-openapi + https://hono.dev/docs/guides/rpc i know i have to chain routes, but i still got unknown (maybe because of zod-openapi ?)...

@vitejs/plugin-react can't detect preamble

i'm trying to get a basic hono/react project working, and i get the above error on the client. i'm working from the following example repo, but i'm modifying it for bun: https://github.com/yusukebe/hono-vite-react-stack/tree/main/examples/basic i know i came across a note about this somewhere, but i can't find it now. the issue linked to by the error isn't especially helpful (for me), and at a glance it appears resolved: https://github.com/vitejs/vite-plugin-react/issues/11#discussion_r430879201...

Hono Client Double-Prefixing Issue

I'm running into a problem with my Hono-based project. On the server, I've set up a base path with: app.basePath('/AdminApi'); so all routes (like /AdminApi/test) are automatically prefixed....
No description

How would you pick between Hono + Client Components vs Hono + React (and with or without HonoX)?

I'm using Hono currently along with Datastar, which has been conceptually great but Datastar is just maybe one tick too immature for my current needs. Hono has been great, so I want to stick with that. Our team knows React reasonably well, so we're leaning that way (and client components would fit just fine), but we're not tied to it. It seems that we have a few choices:...

hono aws lambda 404 issues

I found hono while doing to experimenting with better-auth js and have been testing with it recently. I want to build a hono API in aws lambda for my projects so I can pay per usage instead of provisioning a server to start. I am running into an issue where I am receiving a 404 code back from my API gateway, although the lambda function is being hit with what I assume is the correct path. Although I guess it can't be if I am getting a 404? Anyway, I am attaching the github repo for the AWS CDK build. I am hoping someone can help me figure this out? Please message me if you have run into something similar. Some AI suggested solution mentioned that the stage of the API gateway might be the issue. Basically the "prod" in https://xxxx.execute-api.us-east-1.amazonaws.com/prod/some-path could be getting in the way of the path hono is looking for? I wasnt able to find a solution to this issue though, and when i tested adding the "/prod/..." to the app.get() argument, I still got the 404. ...

Integrating Hono.js with tRPC in Next.js: Routing and Context Considerations

I want to combine Hono.js with tRPC. I followed the guide on the 3rd party middleware made by hono for a tRPC server, and now I have set up the hono tRPC server 3rd party middleware similar to the code below: ```ts import { Hono } from 'hono' import { trpcServer } from '@hono/trpc-server' // Deno 'npm:@hono/trpc-server' import { appRouter } from './router'...

hono/vercel How to change the PORT for local dev?

```ts import { Hono } from 'hono' import { handle } from 'hono/vercel' ...

Form data error

why do i get invalid body error even it has correct content-type header ```ts const formData = new FormData(e.target as HTMLFormElement); fetch('http://localhost:8000/playlist/create', {...

How to build for React + Vite + Cloudflare worker?

I am using this example provided by Cloudflare for Vite + React + Hono https://github.com/cloudflare/templates/tree/main/vite-react-template which works fine if I use it as-is. But I need to change the static index.html to index.tsx to serve the initial html by hono to add title, description, meta tags etc. based on the pathname. So, I changed the index.html with index.tsx...

Custom RPC

Hi, kindly ask for help. I want to have the RPC API type for frontend use. During dev, I facing an issue when do the api in frontend, as my custom apiRoute seems cant support it....
No description

Hono + Nextjs with Cloudflare D1 Cookies problem!

Hi, I am try to build a basic app with hono, nextjs, better-auth, drizzle, cloudflare d1. My goal is to deploy the frontend on cloudflare pages, backend (hono) on cloudflare workers, which will be using cloudflare d1 as database. When developing locally I have 2 separate projects running: :3000 nextjs, :8787 hono (with wrangler dev) Repo: https://github.com/raikusy/nextjs-hono-better-auth-d1 Problem 1: I am using Hono RPC, and I have to manually attach cookies to the request. Because apiClient can be called from both server components and client components src/components/blog-list.tsx...

Hono Supabase OAuth Error

Hi! I am trying to implement OAuth with Supabase in my Hono application. This is a server-side API client and I want to get access to the session of the user. Right now I am doing something like this: ```ts import { Hono } from "hono"; import { getSupabase } from "../middlewares/supabase"; import { envs } from "../config/envs";...
No description

Unsafe call of an `error` type typed value

Hi Hono team! 👋 I'm trying to align a route definition with the generated $get method type, but I'm running into a mismatch and would appreciate your help. This is the content of the type:...
No description
Next