JustUseFirefox
JustUseFirefox
Explore posts from servers
HHono
Created by JustUseFirefox on 9/23/2024 in #help
RPC type error - Unable to interop
6 replies
HHono
Created by JustUseFirefox on 9/23/2024 in #help
RPC type error - Unable to interop
Git link updated
6 replies
HHono
Created by JustUseFirefox on 9/23/2024 in #help
RPC type error - Unable to interop
Someone over at edgedb suggested removing the context and calling the database directly inside a route, but the issue persist. I think it's either how edge e returns type, or how hono infer types for RPC
const routes = app
.post(
'/',
async (c) => {

// Calling this here: fine
const dbClient = createClient();
// Calling this here: error !
const res = await e.select(e.Post).run(dbClient);




const json = await c.req.parseBody();

return c.json({
type: 'authn',
status: 'valid',
});
}
)
const routes = app
.post(
'/',
async (c) => {

// Calling this here: fine
const dbClient = createClient();
// Calling this here: error !
const res = await e.select(e.Post).run(dbClient);




const json = await c.req.parseBody();

return c.json({
type: 'authn',
status: 'valid',
});
}
)
6 replies
HHono
Created by JustUseFirefox on 9/20/2024 in #help
How to pass and validate cookies (server<>server) ? (RPC)
I understand, but in this case, hono client is called on the server (SSR side). I realised this is by design cookie-side. The client have the cookies, and the svelte server receive them. I then need to pass them from svelte server side to hono api in a nice way... But I just resorted to a json post and pass them there with some check.
6 replies
HHono
Created by JustUseFirefox on 9/23/2024 in #help
RPC type error - Unable to interop
Yup, Hono's side of things. I've updated the repo with a simpler version that doesnt rely on @repo/edgedb and multiple imports but the error persist no matter what. Everything points to Hono, as soon as import { type AppRouter } from "@repo/api-hono" is present in Svelte ui, the error appears. But this is kind of required to make use of RPC 😂
6 replies
HHono
Created by JustUseFirefox on 9/23/2024 in #help
RPC type error - Unable to interop
EdgeDB dev confirmed that, for some reason now, hono exports server-only code related to the database and that code gets imported client-side with RPC.
6 replies
HHono
Created by JustUseFirefox on 9/20/2024 in #help
How to pass and validate cookies (server<>server) ? (RPC)
I'll just resort to a json body and make sure the request is coming from a known internal ip
6 replies
HHono
Created by JustUseFirefox on 9/11/2024 in #help
How to use Validator ? Context is not finalized
Found the culprit !!!
app.use(async (c, next) => {
c.set('dbClient', createClient());
c.set('e', e);
next();
});
app.use(async (c, next) => {
c.set('dbClient', createClient());
c.set('e', e);
next();
});
The first middleware that is suppose to make my db connection inside context causes this. Strange as I was succesful into inserting requests but I must have changed something somewhere. 😂 adding await before next() solves the issue 🤦
16 replies
HHono
Created by JustUseFirefox on 9/11/2024 in #help
How to use Validator ? Context is not finalized
I might have found the underlying issue... I'm using const body = await c.req.parseBody() so I need an async function in the main handler. and then I try to return values:
return c.json({
hello: true
// id: insert.id,
});
return c.json({
hello: true
// id: insert.id,
});
https://hono.dev/docs/api/request#parsebody This throws an error api-hono:dev: error: Context is not finalized. Did you forget to return a Response object or await next()?
16 replies
HHono
Created by JustUseFirefox on 9/11/2024 in #help
How to use Validator ? Context is not finalized
don't do anxiety to reply lol, just leaving this here for when you're home and have time 😇 Post form test in the repo: https://github.com/honojs/hono/blob/73ff6c0e82d66468e28ed439481220f56ab03882/src/validator/validator.test.ts#L217 But it doesnt work on my end. On my end, I tried adding next, but it doesnt like it.
validator('form', async (c, next) => {

await next();
}),
validator('form', async (c, next) => {

await next();
}),
This expression is not callable.
Type 'Context<any, string, {}>' has no call signatures.
This expression is not callable.
Type 'Context<any, string, {}>' has no call signatures.
package.json: "hono": "^4.5.11"
16 replies
HHono
Created by JustUseFirefox on 9/11/2024 in #help
How to use Validator ? Context is not finalized
16 replies
HHono
Created by JustUseFirefox on 9/11/2024 in #help
How to use Validator ? Context is not finalized
Thank you very much for taking the time, you're amazing! I'll do that and report back ❤️
16 replies
HHono
Created by JustUseFirefox on 9/11/2024 in #help
How to use Validator ? Context is not finalized
Shit, really ? I didn't see that in any example I think... 😂
16 replies
HHono
Created by Keskas Aymen on 9/11/2024 in #help
zod-openapi infering route handler type from route handler
Oh please please please, make the "Core" public when it's done, I have a swagger documentation I need to make an sdk out of it and this would help a lot
6 replies
HHono
Created by JustUseFirefox on 9/8/2024 in #help
Looking for demo repo on how to implement tests
You're an angel ! Thank you, that is exactly what I was looking for
8 replies
HHono
Created by JustUseFirefox on 9/8/2024 in #help
Looking for demo repo on how to implement tests
Is vitest easier than jest? (the guide refer to jest so I'm wondering)
8 replies
HHono
Created by JustUseFirefox on 5/19/2024 in #help
Is it safe to store user data with set/get?
Okidoo, thanks! ❤️
9 replies
HHono
Created by JustUseFirefox on 5/19/2024 in #help
Is it safe to store user data with set/get?
I almost forgot: I also use the Hono-Sessions middleware, which encrypt/decrypt cookies to c.get('session'). From what I gather in the above GH issue is that might also be problematic :/
9 replies
HHono
Created by JustUseFirefox on 5/19/2024 in #help
Is it safe to store user data with set/get?
For exemple, I use c.get('db') to store a user connection to a database to avoid creating a new one on each request, is that the way to do it?
9 replies
HHono
Created by JustUseFirefox on 5/19/2024 in #help
Is it safe to store user data with set/get?
Thanks for your reply, Nico ! Can you clarify " I never let the application query that data so it can never be leaked accidentally to any user" ? English isn't my native language, this sentence confuses me a bit 😂 I feel like I'm missing something in my interpretation 😛
9 replies