Trouble Integrating with Database and Auth Layers into Effect Runtime

Hi everyone, I'm trying to understand more about effect by trying my hands on a simple project... I'm trying to build a REST API server using Hono and I've kinda hit a wall.

const runtime = Runtime.runPromise(
  Layer.toRuntime(Layer.merge(DatabaseLayer, AuthLayer)) // produces an error
)

export const contextRouter = new Elysia()
  .decorate("runtime", runtime)


So I'm trying to provide a runtime that already has my DatabaseLayer and AuthLayer already in it so that I can save myself from doing something like this in the handler function:

export const router = new Elysia({ prefix: "/auth" })
  .post("/sign-up/strategy/credentials",
    async ({ body: { email, password } }) =>
      strategy.credentials.signIn(email, password)
        .pipe(
          Effect.provide(DatabaseLayer),
          Effect.provide(AuthLayer),
          Effect.runPromise
        ))
Was this page helpful?