Hono

H

Hono

This is the official Hono discord server for the community

Join

RPC type error - Unable to interop

Repro repo: https://codeberg.org/Dreamboat9222/ioMonorepo-Edgedb-Hono-Svelte In a monorepo, I have hono api in one package, and the ui (Svelte) in another and use EdgeDB as the database. It was working a couple of days ago, but I lost all intellisense abilities for 4 days so I was basically coding inside notepad 😂 (The issue is now fixed), but since then this stopped working. I also posted on the edgedb server, but I didn't receive any reply yet. Posting here in case someone have an idea on what is going wrong....

How to pass and validate cookies (server<>server) ? (RPC)

I use Sveltekit and hono as an external API. Most requests coming from the UI are done through XHR, but some requests (like token validation) is done from sveltekit server-side to hono api. - When the user logs in, a cookie is set on the client (secure, lax). - When the user close and re-open the site, the token is validated with a server hook. Sveltekit sees the cookies and make a request to hono, but hono doesn't see the cookies (obviously)....

SolidJS renderToString with Hono: Undefined or 'React not defined' error

Hi everyone, I'm trying to use SolidJS's renderToString function within a Hono server to generate SVG components, but I'm running into issues. The renderToString call always returns undefined, or I get a "React is not defined" error (if I change tsconfig.json to "jsxImportSource": "solid-js"). Has anyone successfully integrated SolidJS's JSX rendering with Hono or has ideas how to do so? If so, could you share how you resolved the JSX compilation for SolidJS? Thanks 🙂 ...

Integration testing with test client and HTTP only cookies

Hello, I have an API with HTTP only cookies built with Hono (Behind Next.js https://hono.dev/docs/getting-started/vercel). I tried to do some integration testing with Hono test client and vitest. I ran into a big issue that is my HTTP only cookies aren't send back to the server. It's normal since HTTP only behavior is handle by the browser and not Node or bun. So I was wondering what tooling or how could i do this integration testing. I want to run it in my CI CD. Any idea or recommendation is welcome ^^...

Accessing .dev.vars outside of context

I use CF Workers and Hono to create an API and to read the secret variables in the .dev.vars you have to go through the context (c) but I want to define my client for several globally because i need to use it in multiple routes, did you know how i can do it? .dev.vars: ``` APPWRITE_ENDPOINT=...

How to extend Hono's JWTPayload

I want to extend the default JWTPayload interface. ``` import type { JWTPayload } from 'hono/utils/jwt/types' ...

streamText only returning one chunk

```typescript chatApi.get("/test", async (c) => { const openai = new OpenAI({ apiKey: c.env.OPEN_AI_API_KEY, })...

How to handle Websocket using "hono/vercel" running on NodeJS environment.

I am using NextJS 14 App Router with Hono to handle the API routes. I followed the documentation using 'hono/vercel', but it seems that it doesn't support WebSocket. Then, I switched to 'hono/node-server/vercel', but I encountered some problems with the response (I cannot use it). Please help me. 😩
No description

Returning multiple files as a stream

i want to return multiple files by archiving them but for some reason the resulted archive is corrupted ``` ts ...

Client Response

I have a problem where what my API returns is not what the TS types say it is: For example what I actually receive when logging res is simply an object that looks like this {email, message}. But there is no ok, json() that my IDE says there should be. This is the route:...
No description

How do I get rest params?

Take the following app: ```ts import { Hono } from "hono"; import { trimTrailingSlash } from "hono/trailing-slash";...

How to use Validator ? Context is not finalized

As soon as I try to use validator, Hono complains. api-hono:dev: error: Context is not finalized. Did you forget to return a Response object or await next()? ...

zod-openapi infering route handler type from route handler

I've been trying for two hours to create a type helper for the route handler so I can extract it to its own file, but I can't figure out why the valid property is not working. I saw cj using it in his syntax hono introduction https://youtu.be/sYZW8TK2IV4?si=iCCHBmv7vA88Phya...
No description

Multiple platforms, same project

Hi! I was wondering if I could have, for the same monorepo, a hono instance to deploy with NodeJS to a traditional long-running server, and also have another instance to be able to deploy to vercel or aws lambda for stuff like cronjobs.

basicAuth context?

Just tried out hono and wanted to add basic auth and wanted to pull data from the Env but the context is any instead of what's set on the Bindings. what am i doing wrong here? ```ts import { Hono } from 'hono' import { basicAuth } from 'hono/basic-auth'...

Looking for demo repo on how to implement tests

Hey there, Is there a demo repository out there that contain tests ? I'm looking for which command to put in my package.json, and some basic exemples on how to test routes, etc. Thanks!...

Weird bug: JSON data not making it to server: RPC

Hi all, I am sending some data to my Hono server like so: ``` const places = await api.map.getPlaces.$post({...
No description

event.pathParameters not populated on AWS Lambda event object

I have an existing AWS Lambda + API Gateway application that I am moving onto Hono. Here is my basic code: ``` type Bindings = {...

Trace when body is consumed

I have a middleware that's basically ```js if (cache.has(key)) { return cache.get(key).clone() }...