Hono

H

Hono

This is the official Hono discord server for the community

Join

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

Invalid state: ReadableStream is already closed

Hello here, I am starting to suspect something odd in @hono/node-server We have random ReadableStream is already closed in the app, everything is try/catch but anyway it crashes the container. ...

JSX dialect documentation?

Where would I look to understand the details of Hono's JSX dialect? For example, I'd like to know if class={} only accepts a string, or if it accepts an object with various classes marked true and false.

Unable to get the client's IP

I am using bun and creating a request middleware to log the requests, but I am having a hard time getting the client's IP address. server.ts file code: ```import { config } from './config/config'; import app from './index'; import { webSocketHandler } from './web-socket'; ...

Can I use hono with JavaScript (not TypeScript)

Hi, I have a very small API project that I'm deploying on cloudflare workers, and was wondering if I can just switch to javascript instead of typescript? I tried searching the docs but can't find anything (possibly skill issues). Apparently JS works, it just shows me all the compiler warnings, but I still want to switch nonetheless. I am aware of the benefits of TS, but need JS for my project specifically. Thank you, and sorry if this has already been answered!...

How to change to FETCH client of Hono to Ky.js or Axios

i like ky.js i wanted to make rpc use ky.js other than normal fetch method im using it with sveltekit ```ts export const honoHandle: Handle = async ({ event, resolve }) => { const client = hc<AppType>('/', { fetch: event.fetch });...

I can't use tsconfig `paths` when using Hono RPC in monorepo

I have monorepo with 2 packages, client & server (Hono). ``` . ├── bun.lockb ├── package.json...
No description

createRoute Wrapper typing

This may not be entirely on topic, but perhaps someone has asked a similar question. How to preserve typing? I'm not that good at TypeScript, I understand that I need to use generics, I looked at the source code, but I still can't fully understand how to do this. Example:...

How to Connect to Services using context

I'm getting frustrated with the repetitive getDb(), getStorage(), and similar function calls in my Hono backend. In other backends I've worked with, I didn’t have to do this as often, which makes me feel like there might be a better way to handle it in Hono. Ideally, I want my services (like database and storage) to be injected into each request automatically, so I can write functions like: ```js...

How to share Hono RPC client type with frontend package?

We have a Hono backend application using Prisma ORM. One day our frontend application added the backend package as a dependency to use Hono RPC. However, this led to the following error since PrismaClient only works in a Node.js runtime: ```...

Component Library SSG

I'm having trouble with CSS imports on SSG. I have HonoX app that i'm trying to add Cloudscape components to. I've got it working on the React renderer, and the build itself works on dev mode. However, on building with SSG, it errors at the first Cloudscape import, because the css module cache returns an undefined. Cloudscape does a lot of internal CSS imports, which should (and do) work. It is only with the SSG plugin. Fine, i would ship dist/index.js and run in server-mode, but if I run without SSG plugin, I get a blank page?? (I would prefer SSG for this project)...

hono/jwt expiresIn

Does hono/jwt have experiesIn? As far as I can see, no, but how can I do it? I like the module because it has everything, so I wouldn't want to install another one separately (even though it's not a big problem).

Migrating from Express to Hono. Static files caching

Hi! Migrating from Express and I do have a hard time understanding how caching works in Hono. In Express we could do this: ```ts app.use( '/assets',...

How can I resolve bundle error with Hono and Bun in monorepo

Hi, could you please tell me how to resolve bundle error with Hono and Bun in monorepo? What I want to do I have created my own Web Components framework. I want to import this framework in the test application with Hono....

How do you manage CSS with server rendered HTML in Hono?

Do most of you just use built-in css helpers, which are basically executing javascript to generate stylesheets? I'm creating app which will be most likely 90% rendered on server, maybe creating static CSS files and serving them would be more efficient? On the other hand - I'd really like to use some UI framework, maybe even headless. Any opinions?...

static files 404 when in subdirectory of assets

Hello, i am using hono with a cloudflare worker to serve the asset folder 'assets' as seen in the examples: ``` <p> Try visiting: <a href="/my-file.txt">/my-file.txt</a> and <a href="/folder/nested-file.txt">/folder/nested-file.txt</a> </p>...

Versions of @hono/zod-openapi >= 0.17 will cause vscode to crash

When I upgraded package @hono/zod-openapi to >= 0.17, vscode's typescript server gets stuck and stays in the state of being loaded with IntelliSense. May I ask what is causing this?

Any lib for API rate limiter in hono CF worker?

I'm looking for something like this: https://www.npmjs.com/package/hono-rate-limit but maintained. Do you know anything? Even some side-code repo would be great...