Trouble with Error Stacktrace in Convex Using Effect Typescript

I'm trying to run an effect inside Convex, but I cannot get error stacktrace to work.

When throwing a regular error in a Convex query with the following code:
export const getProfile = query(async () => {
  throw new Error("an error")
})

I get an output like this:
[CONVEX Q(me:getProfile)] Uncaught Error: an error
    at <anonymous> (../convex/me.ts:50:34)


But when I run an effect like this:
const foo = E.fn("foo")(function* () {
  return yield* new NotAuthenticatedError()
})

export const getProfile = query(async () => {
  await E.runPromise(foo())
})


I get this output:
[CONVEX Q(me:getProfile)] Uncaught (FiberFailure) NotAuthenticatedError: An error has occurred


Even if I try with sandbox like this:
const foo = E.fn("foo")(function* () {
  return yield* new NotAuthenticatedError()
})

export const getProfile = query(async () => {
  await E.runPromise(foo().pipe(E.sandbox))
})


I get this output:
[CONVEX Q(me:getProfile)] Uncaught (FiberFailure) Error: NotAuthenticatedError: An error has occurred
    at next [as next] (<anonymous>)
    at <anonymous> (../../node_modules/.pnpm/effect@3.17.13/node_modules/effect/src/internal/fiberRuntime.ts:198:9)
    at foo (
)


A bit better, but still missing the file and line of the error.
Any ideas how I could fix this?
Was this page helpful?