Skip to content

Commit

Permalink
fix: use rpc client in middleware to avoide workerd issues (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
waigel committed Sep 8, 2024
1 parent 1c7ba1f commit c5f2c19
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/permify/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ export function createCheckPermissionMiddleware(options: MiddlewareOptions): {
throwOnPermissionDenied = true,
} = options;

const client = permify.grpc.newClient(options.client);

return {
checkPermission: ({
entity,
Expand All @@ -103,6 +101,9 @@ export function createCheckPermissionMiddleware(options: MiddlewareOptions): {
tinyassert(entity, "entity is required");
tinyassert(entity.id, "entity.id is required");
tinyassert(entity.type, "entity.type is required");

const client = permify.grpc.newClient(options.client);

// Get the tenant ID from the context variable or use the default tenant ID
const requestTenantId =
tenantIdContextVariable && ctx.get(tenantIdContextVariable)
Expand Down

0 comments on commit c5f2c19

Please sign in to comment.