Hono

H

Hono

This is the official Hono discord server for the community

Join

return early from Promise loop

Platform: Clouldflare Workers & KV So I have a form where that I use to search in my KV storage & return matches. Seems the standard that Hono uses is a Promise.all() & .map inside that. But after I got all the matches I want, it still loops the Promises/map. How do I stop the Promise/map loop, & return the matches? ``` app.post( '/searching',...

Context how it work?

export type AuthUser = { id?: number name?: string; email?: string; };...

[zod-openapi] How to generate a separate requestBody component?

I have several routes that get media files from user requests, and I want to separate them into a separate component to reuse them. But, I also have an array of allowed types to upload. So, I want to make the schema autogenerate itself when I add a new mime type to the array. I wrote this abomination and it doesn't work. I should have stopped when typescript stopped showing the appropriate type for mediaRequestBody. ```typescript...

Issues with Cloudflare KV

Hey everyone, I'm trying to make my KV namespaces accessible in my services using dep injection with tsyringe. Is this something that is known to be unsupported? I found that after injecting the kv namespace the put() and get() methods seemingly blocks execution of anything coming after it, without any errors and no data being set or retrieved....

conninfo doesn't check for x-forwarded-for?

I am on a host with a caddyserver reverse-proxy and want to make sure the client is coming from a whitelist set of IP addresses. So I set up the server using the ipRestriction middleware as per the docs. I am running it using bun. However the reverse proxy uses the x-forwarded-for header. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For I was wondering should conninfo or the ipRestriction middleware check for it?

RPC InferRequestType with Param gives "Property is incompatible with index signature."

I've been learning Hono, been having a great time with it as it solves my biggest grief with NextJS API routes! I've run into some problems with type inference. I have two path params, and would like to be able to simply pass {param: {storeId, billboardId}} to the request call but Typescript complains with the message below [and in screenshot]. Am I using something the wrong way in Hono ? is there a better a way of solving this ? ...
No description

Hono Scalar failed with Vercel serverless function

I use @scalar/hono-api-reference to show an Api documentation and my stack use vercel with api directory. When I use vercel dev or in production mode, I have this error ```...

Adding Cron!

Hello I'm working on a new project using Hono and I'm actually having a ton of fun. The thing is I need to add Cron Jobs to this project and while with other frameworks it's pretty straight forward with official documentation in Hono there is no docs about it. Can anyone help with how it should be achieved?

Using HonoX with React and react-three-fiber

Hey all, I think I may be attempting something a little too tricky. I'm trying to make a HonoX project with a client-only island that uses react-three-fiber. A base install gives this error when hitting the page: ``` module is not defined at eval (/Users/alexturpin/src/project/node_modules/react-reconciler/constants.js:8:3)...

Hono CORS lambda duplicate headers

I'm using Hono with Lambda and managing CORS myself instead of using AWS API Gateway CORS configuration. My code looks like ```...

Trouble with using `hono/cookie` helper with honox

Case 1 - getCookie ```ts import { getCookie } from 'hono/cookie' const cookie = await getCookie(c, 'testCookie');...

Unable to get RPC working with the inferred input type

Server is a simple example from the docs, using Bun. The client is a simple component in Vue. Path-type and return type seems to work correctly, but the input type does not. I would assume type safety should complain if I send it something other than what I give to zValidator? Also, it does not help me auto-complete the query.name...
No description

Nested islands in HonoX

I'm trying to nest islands in fashion similar to this: ``` // islands/toggleSection.tsx export const ToggleSection = (children, isOpen, onToggle) => {...

how to use mongodb with cloudfare hono

Hey guys can anyone help me integrating my mongodb with hono cloudfare.

zValidator Middleware Error

I have literally only implemented the example ```import { zValidator } from "@hono/zod-validator"; import { Hono } from "hono"; import { z } from "zod";...

JSX.Element

Namespace ... JSX has no exported member 'Element'. I have a simple type like this ``` export type PageProps = {...

How to upload a file and track it's progress on the client-side?

I send a file with the following function: ``` const uploadFile = async (thatFile) => { // Use a custom TransformStream to track upload progress...

Cookies not available in other Route

``ts r.get("/login/:userId", async (c): Promise<Response> => { const redirectUri = ${c.env.WORKER_BASE_URL}/callback`; setCookie(c, "userId", c.req.param("userId"), {...

Uploading a file using FormData from React Native to Hono

using Hono 4.4.13 What runtime/platform is your app running on? NodeJs ...
No description