You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR fixes two fire-and-forget promise chains in the gRPC auth interceptor by adding return before each async call, ensuring the promise is propagated to the caller rather than discarded. The README is also simplified to focus on CLI-driven setup rather than manual steps.
src/interceptors/auth.ts: checkWebhookEndpoint and lookupApiKey calls now return their promise chains. The now-redundant return; after the needsWebhook block is removed. This means any unhandled rejection not caught by the local .catch is surfaced to the gRPC framework rather than silently dropped.
README.md: Content rewritten to lead with the bunx scrawn@latest CLI workflow, dropping the manual Docker / migration / env steps and adding an SDK snippet.
Confidence Score: 5/5
Safe to merge — the two-line change is minimal, targeted, and consistent with the existing error-handling pattern throughout the interceptor.
Both async branches already had .catch handlers that forward errors to the gRPC callback; the only change is surfacing the returned promise instead of discarding it. The logic, error paths, and callback flow are identical to before — no new code paths are introduced and no existing checks are removed.
No files require special attention.
Important Files Changed
Filename
Overview
src/interceptors/auth.ts
Adds return to two fire-and-forget promise chains; removes now-redundant explicit return — correct fix with no behaviour regressions.
README.md
Documentation-only rewrite: shorter, CLI-first quick-start with an SDK code snippet; no code logic affected.
Sequence Diagram
sequenceDiagram
participant C as gRPC Client
participant I as authInterceptor
participant AC as apiKeyCache
participant DB as PostgreSQL
participant WC as webhookEndpointCache
participant H as gRPC Handler
C->>I: request (Bearer token)
I->>I: "validate header & key format"
I->>AC: cache.get(apiKeyHash)
alt Cache HIT
AC-->>I: cached record
I->>I: role check
alt needsWebhook path
I->>WC: webhookEndpointCache.get(apiKeyId)
alt cache miss
WC->>DB: SELECT webhook endpoint
DB-->>WC: result
end
WC-->>I: hasEndpoint
alt hasEndpoint
I->>H: return handler(call, callback)
else no endpoint
I-->>C: callback(permissionDenied)
end
else standard path
I->>H: return handler(call, callback)
end
else Cache MISS
I->>DB: return lookupApiKey(hash)
DB-->>I: apiKeyRecord
I->>I: validate (null/revoked/expired/role)
I->>AC: apiKeyCache.set(...)
alt needsWebhook path
I->>WC: return checkWebhookEndpoint(id)
WC-->>I: hasEndpoint
alt hasEndpoint
I->>H: return handler(call, callback)
else no endpoint
I-->>C: callback(permissionDenied)
end
else standard path
I->>H: return handler(call, callback)
end
end
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…andled rejections