Skip to content

fix: hand-roll authorize promise wrapper to avoid DEP0174#749

Merged
cb1kenobi merged 1 commit into
mainfrom
fix-promisify-authorize-dep0174
May 23, 2026
Merged

fix: hand-roll authorize promise wrapper to avoid DEP0174#749
cb1kenobi merged 1 commit into
mainfrom
fix-promisify-authorize-dep0174

Conversation

@cb1kenobi
Copy link
Copy Markdown
Member

@cb1kenobi cb1kenobi commented May 22, 2026

Summary

  • Replace util.promisify(auth.authorize) with a small manual callback→promise wrapper to silence the Node.js DEP0174 deprecation warning.

Why

auth.authorize is a Node-style callback function ((req, res, next)), but some of its branches return the promise from an inner authentication(...).then(...) chain. Node now flags this combination as a likely misuse of util.promisify. The wrapper is semantically identical to what util.promisify was doing — it just doesn't perform the deprecation check.

The goal of this PR is to reduce warnings.

Where to look

  • server/serverHelpers/serverHandlers.js — new pAuthorize wrapper replacing the util.promisify call. Behavior should be unchanged for both consumers (authHandler and authAndEnsureUserOnRequest).
  • Long-term fix is to convert authorize itself to async; a TODO-style comment is added noting this can be removed once that happens.

🤖 Generated with Claude Code

`util.promisify(auth.authorize)` triggered DEP0174 because some branches of
`authorize` return the promise from the inner `authentication(...).then(...)`
chain, which Node now treats as a likely misuse. Replace with a small manual
callback->promise wrapper that preserves existing semantics. Fully converting
`authorize` to async would be invasive due to its fastify middleware shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cb1kenobi cb1kenobi requested a review from kriszyp May 22, 2026 21:48
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 22, 2026

Reviewed; no blockers found.

@cb1kenobi cb1kenobi marked this pull request as ready for review May 22, 2026 22:03
@cb1kenobi cb1kenobi merged commit a390bbf into main May 23, 2026
38 checks passed
@cb1kenobi cb1kenobi deleted the fix-promisify-authorize-dep0174 branch May 23, 2026 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants