Hono

H

Hono

This is the official Hono discord server for the community

Join

Seeking Help with Prisma Accelerate and Hono Setup in Turborepo

Hello, I'm Christer, and I'm currently working on an open-source project using Hono with Prisma. I have everything running on my local server, but I've encountered an issue that I believe might require some tweaking on my end. I'm utilizing a turborepo for this setup, and I suspect that I might need to use Prisma Accelerate to get Hono working properly. Below is the error message I'm seeing:...
No description

What is the correct project structure for RPC?

I'm working with React Native, and I want to use Hono.js for the backend, is this project structure correct to use RPC? [project name folder] ├── react native folder ├── honojs folder...

how to stop request that being processing by hono server from client?

i'm thinking about AbortController from vanilla javascript, but it is only aborting the request in the client right? how can i abort the request in the server, which in this case is processed by hono. i only found this [1], but it is used for RPC, in my case hono is run on different server. i also found this issue [2] but i didn't see the abort method. hono v4.3.4 [1] https://hono.dev/guides/rpc#init-option...
No description

Difficulty using OpenAPI registry parameters with createRoute

My setup is index.ts -> has hono app, imports routes schema.ts -> has zod schemas defined routes.ts -> uses createRoute from defined schemas ...

OpenAI Streaming doesn't work

hi, I want to stream the openai response to my frontend. In my frontend, the text is suddenly displayed and is not streamed. In my backend code I see through the consolge log that it outputs the words individually. But in the browser dev tools it looks like the client gets the data all at once. I'm not sure why it doesn't work. Does anyone have a guess? ```ts //backend const res = await openai.chat.completions.create({ model: 'gpt-3.5-turbo',...

Error: Missing Clerk Secret key

I'm using clerk with hono middleware to handle auth: https://clerk.com/changelog/2023-11-08 The code is really simple: `import { clerkMiddleware, getAuth } from "@hono/clerk-auth"; import { serve } from "@hono/node-server";...

App breaks in RPC mode, works normally

Hi, as soon as I export the AppType as mentioned in the docs. I start getting this error. If I do not export the AppType and do the normal export default app;, app works fine here is my index.ts ``` import { Context, Hono } from 'hono' import { secureHeaders } from 'hono/secure-headers'...
No description

Hono with Node

How to get the .env variables from the context in hono with the node tamplate?

Websockets

Am I missing something I got this error and I don't found how to fix it with the doc (screenshot from hono node module) I also checked if my setup was correct and it was like this (screenshot where we see initsocket())...
No description

Any way to modify the request path in middleware?

(this is cross-posted on https://github.com/orgs/honojs/discussions/2642 - I'm not quite sure which forum we are meant to use? trying both, apologies for the noise) I am trying to replicate a legacy API which had optional versions in paths, so GET /v1/foo actually called GET /foo under the covers. I was hoping to add some middleware that just intercepted paths starting with /v1 and removed the prefix (or re-directed somehow to the correct route) - but it seems that modifying the ctx.req.path does nothing....

Handling promises resolvers with an in-memory `Map` object

Hello folks, I am developing an app that's using a structure similar to the one in the attached index.ts file. The project I'm building requires starting a request from one client and "confirming" the request from another client. This means that client A must reach out to the /hello-request endpoint, and client B must use /hello-confirm/:helloId to resolve the request. This also works under the assumption that client B would be sent the helloId value in a separate step....

zValidator middleware custom hook

Hi! Iam trying to create a custom error message for my validator, I am using "query" works fine, the data is there but the data isn't being passed to the next function in the chain, resulting in errors because q becomes undefined. Hope someone can help me ```ts const errorHandler: Hook<Record<string, unknown>, Env, string, {}> = async (result, c) =>{...

Setting up Client Components

I'm trying to setup a simple counter client component, code can be seen below. Code is minimal so it's easy to test it (first time using client components on hono) When using the example given in the docs, an "obvious" error that document is not defined would happen, since I'm in the server. Code: ...

Seeking Guidance: Transitioning from Hono.js with Cloudflare Workers to AWS Lambda

Hello, guys! Does anyone have a project that combines Hono.js with AWS Lambda? Please share it here. It would be helpful for me to work with this tech stack. I have worked with Hono.js and Cloudflare Workers, and it's really fast. However, some npm packages do not support edge computing. Therefore, I am planning to switch my upcoming project to AWS. ( hono js + aws lambda ) However, due to the lack of documentation, I am unable to work with Hono.js on AWS Lambda, and there is no option to run the server locally. ...

How do I properly serve static files (generated by Astro)?

I'm trying to serve files built by Astro along with their imports. Currently only the html files without imports get served. For example, http://localhost:3000/_astro/headerBg.C9Twm_Bk.png returns 404. Here's my project structure:...

When there's an error on my typescript code on Hono, Vite Dev Server crashes, and doesn't restart

Problem: - Error? Crash the dev server and not wait for file changes. Ideal experience: - Error? Say it's an error and wait for file changes....

How to implement Oauth in Hono?

I am a beginner. I have used next-auth in next js. Is there a way to implement google Oauth in hono? Code and youtube videos are appreciated. Is there any library i can use?

Failed to load .env file ".env": Error: ENOENT: no such file or directory

Hey, Im new to using cloudflare and new to using Hono. I now came across an error that tells me Im missing a .env file, which also should contain some variables. The problem is, idk where I use these and what their values should be. It seems like these should be using system variables instead (Im currently on Windows 10), but I could find an answer online. This only started appearing after I added and tried using Hono. Here is my code: ```typescript import { Hono } from "hono";...

executionCtx.waitUntil on write service

I have a worker that I want to call an external api on, but I want to return a response without awaiting the the external api call. (the external api call is to just save time writing to the db on another service). ```javascript const promise = fetch('http://localhost:3000/impression', { method: "POST", body: JSON.stringify(data),...

Does Hono JSX do client-side hydration?

I.e. are client events like on:click meant to work? And if not, how can it be enabled / done in other ways?