Hono RPC + Clerk Middleware in Next.js Server Actions/Components
I am using the
clerkMiddleware
in Hono and was wondering if this is the correct way to make authenticated
requests with serverComponents
and server Actions
by simply forwarding the cookie value from the next/headers
. Should there any other headers be forwarded?
Here are the steps:
1) Add Hono Middleware...RPC Type confusion
The RPC package has some unexpected behaviours and I'm hoping someone can give me some insight.
This is the return value of the API route (pic 1) and what it's shown as on the other end of RPC (pic 2)...
How to add custom message to error Bearer Auth
```
export const auth = bearerAuth({
verifyToken: async (accessToken: string, c: AppContext) => {
try {
const jwtPayload: JWTPayload = await verifyAccessToken(accessToken);...
Live Reload With Deno
I am using the Deno runtime with Hono and I was looking for a way to add live reload. I have searched for module but with little success. Can anyone point me in the direction of a resource so I can get the browser to refresh on save?
Cheers
Jim...
Return early from middleware
Hello, I want to return a 200 response from a middleware if certain conditions are not met, else run await and cleanup after the await. How can I return early from the middleare function?
Websockets connected clients count
Hi, I'd like to know how to get the amount of connected clients.
```ts
import { Hono } from 'hono'
import { upgradeWebSocket } from 'hono/cloudflare-workers'...
Hosting Hono Bun on GCP Cloud Run
Has anyone managed to get an instance running with Hono Bun running on Cloud Run and is willing to share their Dockerfile and package.json for it?
Type safety for middleware that sets context variables
I have an authentication middleware which ensures the user is logged in and adds the
user
to the context if they are. My middleware adds the type of this context variable per the docs:
```typescript
declare module "hono" {
interface ContextVariableMap {...Error per route
Hello everyone, this is a very basic question but I couldn't find any help online.
I was just wondering if it was possible to have any error handling callback per route.
For example with this code, how would you handle this error only for this route ?
I know I can use .onError but that would be global right ? ...
Use OpenAPI operationId inside Middleware
It's possible to use the Zod OpenAPI
operationId
route value inside a middleware?FormData with images and string
I'm getting 4 images from with username, email and password from frontend.
I want to process and save all the files in my local directory and path in database with username, email and password. I'm not able to find any solution on internet. Can I do this without multer or busboy? If someone done this or have an idea please share...
Hono client issues with newrelic?
Guys, I almost gave up.. I cant solve the issue:
- I added newrelic for monitoring
- All my endpoints goes to 401 Unauthorized
...
Match both `/` and `/:id` routes the the same router
Hello, is there any way to handle 2 routes in the same router? We want to handle requests coming to both
/
and /:id
to handle when id is undefined or has a value.Server Sent Events
Hello guys! Sorry if this was asked before. I'm trying to implement an event emitter with SSE like this:
```ts
const emitter = new EventEmitter();
app.use("/sse/*", async (c, next) => {...
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',...[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?