fix: Return bearer middleware result instead of awaiting#1049
fix: Return bearer middleware result instead of awaiting#1049
Conversation
- Fix bearerAuth middleware usage in internal and artifacts routes by returning the middleware result instead of just awaiting it - Add vitest packages to renovate ignore list to sync with .ncurc.json
🦋 Changeset detectedLatest commit: 9f57963 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughReturn middleware functions directly instead of awaiting them in two route handlers to ensure the middleware promise is propagated to the caller, fixing worker promise handling errors. Changes
Sequence DiagramsequenceDiagram
participant Worker
participant Route
participant Middleware
rect rgba(255, 0, 0, 0.5)
Note over Worker,Route: Old (Broken) Pattern
Worker->>Route: Request
Route->>Middleware: await middleware(c, next)
Middleware-->>Route: Resolves
Route-->>Worker: undefined
Worker-xRoute: ❌ Error: Worker returned Promise
end
rect rgba(0, 255, 0, 0.5)
Note over Worker,Route: New (Fixed) Pattern
Worker->>Route: Request
Route->>Middleware: return middleware(c, next)
Middleware-->>Worker: Promise
Worker->>Middleware: Awaits promise
Middleware-->>Worker: ✅ Success
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
🌩 Deploying with Cloudflare Pages
|
🌩 Deploying with Cloudflare Pages
|
Fixes #1045