JustUseFirefox
Explore posts from serversRPC type error - Unable to interop
Repro repo: https://codeberg.org/Dreamboat9222/ioMonorepo-Edgedb-Hono-Svelte
In a monorepo, I have hono api in one package, and the ui (Svelte) in another and use EdgeDB as the database. It was working a couple of days ago, but I lost all intellisense abilities for 4 days so I was basically coding inside notepad 😂 (The issue is now fixed), but since then this stopped working. I also posted on the edgedb server, but I didn't receive any reply yet.
Posting here in case someone have an idea on what is going wrong.
Inside hono if I remove the database from context the error disappear:
In svelte I import this to make API queries:
But for some reason, when I try to load the UI, it throws
Unable to interop
export * from "edgedb/dist/reflection/index.js" in ...Monorepo/dbschema/edgeql-js/reflection.mts, this may lose module exports. Please export "edgedb/dist/reflection/index.js" as ESM or use named exports instead, e.g.
export { A, B } from "edgedb/dist/reflection/index.js"
Removing
import { type AppRouter } from "@repo/api-hono" and the type next to hc removes the error, but then I lose all types for my API calls.
Edgedb types are generated with
bunx @edgedb/generate edgeql-js --target esm (I tried mts too, same error)
Inside the browser, the following error appear:
TypeError: $.StrictMap is not a constructor`
- I removed all node_modules folders and reinstalled the deps
- I removed dbschema/edgeql-js and regenerated the types
- I double-checked tsconfig files but didn't spot anything, but I'm no specialist.
Any idea please ? 😰6 replies
How to pass and validate cookies (server<>server) ? (RPC)
I use Sveltekit and hono as an external API.
Most requests coming from the UI are done through XHR, but some requests (like token validation) is done from sveltekit server-side to hono api.
- When the user logs in, a cookie is set on the client (secure, lax).
- When the user close and re-open the site, the token is validated with a server hook. Sveltekit sees the cookies and make a request to hono, but hono doesn't see the cookies (obviously).
I don't want to store too much information in localStorage, so a page refresh require token decryption.
I'm looking for a way to pass down those cookies from svelte server to hono api, but that endpoint might also be called from a browser or something, so for security reason I don't want to use
json
to pass the data preferably. Cookies is the way to go here.
Validator:
Client call:
6 replies
How to use Validator ? Context is not finalized
As soon as I try to use validator, Hono complains.
api-hono:dev: error: Context is not finalized. Did you forget to return a Response object or
await next()
?
Any idea? :\
EDIT:
I'm using Superforms to send the request. Devtool says the data it is indeed Form Data.
If I replace form with json, it doesnt throw the error, but the value is empty16 replies
How to upload a file and track it's progress on the client-side?
I send a file with the following function:
I'm unsure how I can get the file on the api side and write it to disk, or delete the temp file if the upload is aborted. Any tips? 😇
1 replies
Is it safe to store user data with set/get?
I read (https://github.com/honojs/hono/issues/585#issuecomment-1826189093) that context state can be shared if the request is handled by the same worker. Is it safe to store user/session data with set/get?
9 replies