Error with HttpApiMiddleware Implementation in Effect-TS

hey, i have a question about the HttpApiMiddleware as documented here: https://github.com/Effect-TS/effect/blob/main/packages/platform/README.md#implementing-httpapisecurity-middleware

I created the authorization middleware (this is basically just copied from the docs)

class Authorization extends HttpApiMiddleware.Tag<Authorization>()(
  '@markprompt/Authorization',
  {
    // add your error schema
    failure: Unauthorized,
    // add the Context.Tag that the middleware will provide
    provides: ProjectRouteParams,
    // add the security definitions
    security: {
      // the object key is a custom name for the security definition
      bearer: HttpApiSecurity.bearer,
      // You can add more security definitions here.
      // They will attempt to be resolved in the order they are defined
    },
  },
) {}

export const AuthorizationLive = Layer.effect(
  Authorization,
  Effect.gen(function* () {
    yield* Effect.log('creating Authorization middleware');

    // return the security handlers
    return Authorization.of({
      bearer: (bearerToken) =>
        Effect.gen(function* () {
          return yield* Effect.succeed({
            projectId: 'testing',
          });
        }),
    });
  }),
);


I created the http server:

const HttpLive = HttpApiBuilder.serve(HttpMiddleware.logger).pipe(
  Layer.provide(PublicApiLive),
  Layer.provide(AuthorizationLive),
  HttpServer.withLogAddress,  Layer.provide(NodeHttpServer.layer(createServer, { port: 3001 })),
);


but im getting this error:

`The 'this' context of type 'Effect<never, HttpBodyError | ServeError, ProjectRouteParams>' is not assignable to method's 'this' of type 'Effect<unknown, unknown, never>'.
  Type 'ProjectRouteParams' is not assignable to type 'never'.


PublicApiLive is a layer that requires ProjectRouteParams. I would expect that AuthorizationLive provides that but it seems like its not
Was this page helpful?