fix(api-server): add required 'alg' option to JWT middleware#4368
Open
AmriteshKhare wants to merge 1 commit intopear-devs:masterfrom
Open
fix(api-server): add required 'alg' option to JWT middleware#4368AmriteshKhare wants to merge 1 commit intopear-devs:masterfrom
AmriteshKhare wants to merge 1 commit intopear-devs:masterfrom
Conversation
Hono v4.11.10 changed the JWT middleware to require an explicit 'alg' parameter. Without it, all /api/* endpoints return HTTP 500 Internal Server Error, completely breaking the api-server plugin for any client (e.g. remote control apps, WebSocket connections). This adds alg: 'HS256' to match the algorithm used by the sign() function in the auth route.
This was referenced Mar 9, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The
api-serverplugin's JWT middleware is missing the requiredalgoption, which was introduced as a mandatory parameter in Hono v4.11.10. This causes all/api/*endpoints to return HTTP 500 Internal Server Error, completely breaking:/api/v1/song,/api/v1/play, etc.)/api/v1/ws)Error
Fix
Added
alg: 'HS256'to thejwt()middleware options insrc/plugins/api-server/backend/main.ts. This matches the algorithm used by thesign()function in the auth route (hono/jwtdefaults to HS256).Changes
src/plugins/api-server/backend/main.ts: Addedalg: 'HS256'to JWT middleware config (1 line)Testing
/api/v1/songreturns HTTP 200 with correct song data/auth/{id}authentication flow works end-to-end/api/v1/ws