Hono

H

Hono

This is the official Hono discord server for the community

Join

Hono Help with Cloudflare Workers

Hello, this is Patrick and I am experienced developer in backend but just dive into Serverless architecture with Cloudflare workers. I'm looking to learn how to use Cloudflare Workers with Hono.js, Prisma to build website. I need to make basic environment asap to finish my task. Thanks....

Factory app creation

Hi, I'm building a backend using Hono and am splitting up my routes into groups, for example '/authors', and '/books'. Each group is written in a separate file and then imported to the main Hono app which will serve the app. Right now I have authentication middleware on the main app and in that middleware the "user" context is set so we can access the current user on the routes below, however since the "books" and "authors" sub-apps are imported to the main app from a different location they don't have access to the context set by the middleware in the main app. In the "books" app I want to be able to access the "user" context from the middleware. What is the recommended way of doing this? nb: It seems like createFactory().createApp() was the recommended way to do this, however this seems to be deprecated?...

RPC typing is behaving weird

I'm not sure if this might be an issue with my setup or with Hono itself, but I'm a bit at a loss here I have a Hono router for projects which I want to use as a projectsClient with hc. For this I take my projects Router and extract the Type like this: ...

Are middleware singleton like in ElysiaJS ?

Hello, Just wondering if middleware were singleton like in Elysia ? I have a middleware which is my dependency container, and I need to apply a .use(container) on each route which needs to access the container. Should I add a check in my code to not add my variables to context if it already been added ? Or does Hono do this for me with a specific option ? Thx for your answers 🙂...

Extract routes from hono definition

Hi everyone, i want to extract all the routes from hono definition for example : ```ts export const app = new Hono<Env>() .route('/transactions', transactionsRoute);...

Honox + Vite + Prisma

When I try to use Prisma client libraries, I get errors in my dev server: ``` module is not defined...

Cookie Comes Back As undefined

Hello. I'm using Hono and having an issue setting a cookie on one endpoint and retrieving it in the middleware of another. I was wondering if someone could advise as to why it comes back undefined. Thanks! ```ts authRouter.get('callback', async (c) => { // irelevant logic......

Websocket subprotocol results in Error: The script will never generate a response

Websockets - sending subprotocols (auth token smuggling) results in Error: The script will never generate a response. Client: ``` const ws = new WebSocket(wsUrl, "potato");...

How to add credentials to a Hono client?

I see hono documentarion unfortunately lacks a lot of information on how to use it appropriately, and It's no different with this piece of information, so I'd like to know how to or if it's even possible to make authentication via cookies. Can anyone help me?

Post method not working with Queues on CF Worker

Hono version: 4.6.20 Wrangler version: 3.107.2 I've tried a lot but fetch function inside queue is not executing in the worker both deployed version and local dev server. ...

I'm looking for more clarity on client components

I've tried following the documentation but I can't seem to get a hono project working with the client components helper. https://hono.dev/docs/guides/jsx-dom can anyone provide a comprehensive snippet on how to set this up? 🥺...

Using @hono/auth-js with one API server (auth) and one web server (front) ?

Hey, hope Hono fans are doing well, I'm wondering if it's possible to use a distant API (not on the same hostname) with authjs ? I've seen multiple examples with @hono/auth-js but they are always relying on the vite proxy server to serve the api on the same host as the frontend server. Example usages of the @hono/auth-js lib : - https://github.com/divyam234/next-auth-hono-react...

Hono + Bun + Better Auth 404 error when using app.route

Hey, I'm trying to setup a hono server like this, but when I call the /api/auth/ok endpoint I got a 404. In fact I'm also using a app.route() in my entryfile. A very strange behavior break the "/api/auth/**" matching Working version ```ts...

Help with REGEX doesnt work on route path definition

I have this route definition: ``` app.on(["POST", "GET"], "/api/auth/**", (c) => { return auth.handler(c.req.raw);...

Configuring Storybook with Hono

Hey, I am trying to configure storybook with Hono, is there an easy way of doing this? Thanks!...

TSX layout / templating question

- is there a way to link a static style sheet from the server side tsx components?? i've been trying, searching and proompting, what am i missing... - im using server side tsx to render html and i want to link a style sheet instead of using the jsx css helper, can i just link a stylesheet like normally? main.tsx...

relative pathname in Request not working on POST request

Using the pathname in a GET request everything works fine. Code: ```js test("GET: all car brands", async () => { const res = await app.request("/api/brand");...

What is the difference between `Zod OpenAPI` and `Hono OpenAPI`?

From reading the docs I can't tell why I should use one as opposed to the other. Can I use both? If so, how?

Can't get the RPC typing

Hey ! Hope you're doing well, I have an issue with the RPC types, how can I manage to get the client types ? ```ts // hc.ts import router from "./root";...

Image uploaded to S3 cannot be displayed when run on Lambda

I'm trying to upload images to S3 via AWS Lambda using Hono, but when I open the image url it shows The image cannot be displayed because it contains error My Setup: - Frontend: SvelteKit, sending a multipart/form-data request with the image. - Backend: AWS Lambda with Hono ...