Hono

H

Hono

This is the official Hono discord server for the community

Join

How to get strict inference with RPC

Here's an example I found online https://x.com/honojs/status/1953608853654057157 In this example, the RPC infers the response as a "string" rather than the literal Hi!. I somewhat got around this by adding as const at the end of { message: "Hi!"} so it looked like { message: "Hi!"} as const but then I couldn't assign variables to the response of that API call because the API calls response is infered as readonly ...

Hono Vite DevServer: Wrangler Workers - Proxy is not initialized

I am trying to setup the Hono vite dev server with the wrangler adapter, for some reason theres a race condition with the wrangler proxy. Here is my config: ```typescript import { defineConfig, type PluginOption } from 'vite'...

How to connect Vite, Hono and Cloudflare Workers?

I am trying to connect Hono with Vite on Cloudflare Workers, everything works, but the wrangler config. for some reason even with the adapter, the wrangler.toml doesn't get picked up and it fails to load environment variables. ```typescript import { defineConfig } from 'vite' import devServer from '@hono/vite-dev-server'...

Vercel errors and noob questions

I am trying to deploy my simple hono app to vercel. I picked the vercel template when I ran the installer. I use better auth and this is the only thing I got in my index.ts right now: ```...

Hono and cloudflare bindings

I am using hono, orpc, drizzle and supbase. I want to create a db binding because the current set up is causing internal server error with cloudflare workers, database connection is getting created on every request, but i cant seem to find any doc or post about setting it up

hono + vercel + monorepo + turborepo -- what is the trick?

is there a trick to getting vercel.json to be used with turborepo? I have pnpm managing my monorepo but it seems like my apps/heimdall/vercel.json keeps getting ignored ``` { "$schema": "https://openapi.vercel.sh/vercel.json",...

Unable to render jsx with bun

Trying to utilize hono html and css for html rendering, but seem to get error: Cannot find module 'react/jsx-dev-runtime'. Sample code: ```ts import {Hono} from 'hono'...

Can I use JavaScript?

I changed the package.json file, and the program runs normally. I'm not sure if I need to change anything else.
No description

Serve Static file fail

Hi, kindly ask about serve static file issue. ```typescript ../prj/attendance_script/server/app.ts...
No description

OpenAPI route with 204 + content: {} cause type error with c.body(null, 204)

This is probably a bug i tried many ways to solve it but i will either get a typecheck error on the handler or lose inference for that route altogether library versions:
@hono/zod-openapi 0.18.4 @hono/zod-validator 0.4.3...

Hono: getCookie() Returns Undefined — Need Help!

Hey everyone! I'm working on a backend using the Hono framework and I'm trying to implement cookie-based authentication. I'm setting a JWT token in the cookie after login using setCookie, and I can see that the cookie is being set properly in the browser. But when I try to access it in my middleware using getCookie, it always returns undefined. I already set credentials: "include" on the frontend and allowed credentials in the CORS config, but still not working....
No description

OpenAPI not validating content type?

Let's say I have a post endpoint that takes json like this ```json { "name": "test" "age: 30...

double encoding oauth redirect uri

I'm using @hono/oauth-providers and my redirect URIs get double-encoded in Docker but not locally: - Docker: redirect_uri=https%253A%252F%252F... ❌ - Local: redirect_uri=https%3A%2F%2F... ✅ Setup:...

How to Retrieve Session in Next.js RSC Without Getting 401 (Next.js + Hono Integration)

Hi, I'm building a full-stack app using Next.js for the frontend and Hono.js for the backend, running on separate ports in development (localhost:3000 for Next.js and localhost:8787 for the Hono server with Better Auth). I’m using the following logic on the client side to get the current user:...

Type Error with zodValidator and arktypeValidator

Basically I have this ```ts import { arktypeValidator } from "@hono/arktype-validator"; import { type } from "arktype"; import { Hono } from "hono";...

Getting corrupted binary responses instead of JSON from Hono gateway service with axios

Hi everyone! I'm having an issue with my Hono-based API gateway that forwards requests to microservices. I’m receiving corrupted binary responses instead of the expected JSON when using axios or fetch from my React Native frontend. Problem: Requests return binary-like data instead of proper JSON: ```...

React Native / Expo

Hello i have Monorepo expo app and i want to use hono rpc client in my react app but if i try import it with this metro config i get this error ```js const { getDefaultConfig } = require("expo/metro-config"); const { withNativeWind } = require("nativewind/metro");...
No description

Inferring the response type of a handler

I'm trying to infer the return type of a route on my server. Any tips on what I'm doing wrong? ``` import type { Env } from "@/types"; import { createFactory } from "hono/factory"; import { InferResponseType } from "hono";...

JSX with no-value attribute

Using Datastar, it's convenient to create signals using <input data-bind-foo /> or <div data-signals-bar></div>. But Hono converts them to <input data-bind-foo="true" /> and <div data-signals-bar="true"></div>, causing datastar error. Is it possible to turn off that feature without using raw()?...
Next