Hono

H

Hono

Join the community to ask questions about Hono and get answers from other members.

Join

hono aws lambda 404 issues

I found hono while doing to experimenting with better-auth js and have been testing with it recently. I want to build a hono API in aws lambda for my projects so I can pay per usage instead of provisioning a server to start. I am running into an issue where I am receiving a 404 code back from my API gateway, although the lambda function is being hit with what I assume is the correct path. Although I guess it can't be if I am getting a 404? Anyway, I am attaching the github repo for the AWS CDK build. I am hoping someone can help me figure this out? Please message me if you have run into something similar. Some AI suggested solution mentioned that the stage of the API gateway might be the issue. Basically the "prod" in https://xxxx.execute-api.us-east-1.amazonaws.com/prod/some-path could be getting in the way of the path hono is looking for? I wasnt able to find a solution to this issue though, and when i tested adding the "/prod/..." to the app.get() argument, I still got the 404. ...

Integrating Hono.js with tRPC in Next.js: Routing and Context Considerations

I want to combine Hono.js with tRPC. I followed the guide on the 3rd party middleware made by hono for a tRPC server, and now I have set up the hono tRPC server 3rd party middleware similar to the code below: ```ts import { Hono } from 'hono' import { trpcServer } from '@hono/trpc-server' // Deno 'npm:@hono/trpc-server' import { appRouter } from './router'...

hono/vercel How to change the PORT for local dev?

```ts import { Hono } from 'hono' import { handle } from 'hono/vercel' ...

Form data error

why do i get invalid body error even it has correct content-type header ```ts const formData = new FormData(e.target as HTMLFormElement); fetch('http://localhost:8000/playlist/create', {...

How to build for React + Vite + Cloudflare worker?

I am using this example provided by Cloudflare for Vite + React + Hono https://github.com/cloudflare/templates/tree/main/vite-react-template which works fine if I use it as-is. But I need to change the static index.html to index.tsx to serve the initial html by hono to add title, description, meta tags etc. based on the pathname. So, I changed the index.html with index.tsx...

Custom RPC

Hi, kindly ask for help. I want to have the RPC API type for frontend use. During dev, I facing an issue when do the api in frontend, as my custom apiRoute seems cant support it....
No description

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).
Next