HonoH
Hono•16mo ago
JustUseFirefox

RPC 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:
app.use(async (c, next) => {
  c.set('dbClient', createClient());
  c.set('e', e);
  await next();
});


In svelte I import this to make API queries:
import { type AppRouter } from "@repo/api-hono"
import { hc } from 'hono/client'

export const hono = hc<AppRouter>(API_ENDPOINT, {
    init: {
        credentials: 'include'
    }
});


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 ? 😰
Codeberg.org
Reproduction repo
Was this page helpful?