Skip to content

chore(deps): bump web/backend to fastify 5 + matching plugin majors#345

Merged
padak merged 1 commit into
mainfrom
chore/bump-backend-fastify5
May 25, 2026
Merged

chore(deps): bump web/backend to fastify 5 + matching plugin majors#345
padak merged 1 commit into
mainfrom
chore/bump-backend-fastify5

Conversation

@padak
Copy link
Copy Markdown
Member

@padak padak commented May 25, 2026

What

Consolidated web/backend (Node BFF) dependency bump that supersedes Dependabot PR #342.

Package From To
fastify ^4.28.1 ^5.8.5
@fastify/cors ^9.0.1 ^11.0.0
@fastify/static ^7.0.4 ^9.0.0

(fast-uri 2→3 comes in transitively via fastify 5.)

Why

#342 bumped fastify to 5 but left @fastify/cors@^9 and @fastify/static@^7 — both built for fastify 4. fastify-plugin enforces the accepted fastify range at registration, so the BFF throws at startup:

fastify-plugin: @fastify/cors - expected '4.x' fastify version, '5.8.5' is installed

server.ts registers both plugins on boot, so #342 as-is would break kbagent serve's Node BFF. No CI job builds or runs web/backend (the wheel-build job only builds web/frontend; check is Python), so green CI on #342 does not validate the backend — same partial-bump trap as #337/#338.

Verification (local, end-to-end against a live project)

  • npm ci clean; npm run build (tsc) clean with fastify 5 types
  • BFF boots and registers both plugins without the version error
  • /__bff/health{"status":"ok"}, /__bff/infokbagent.ready:true
  • live /api/projects proxied BFF → kbagent serve → Keboola → 34 projects (proxy.ts reply.raw streaming works on v5)
  • CORS preflight → 204 with access-control-allow-origin: http://localhost:5173 (@fastify/cors@11)
  • @fastify/static@9: GET / serves index.html, /assets/*.js served, SPA-fallback route → 200

Closes #342


Open in Devin Review

Dependabot PR #342 bumped fastify 4->5 (and fast-uri 2->3) but left
@fastify/cors at ^9 and @fastify/static at ^7 -- both built for fastify 4.
fastify-plugin enforces the version at registration, so the BFF would
throw at startup: 'fastify-plugin: @fastify/cors - expected 4.x fastify
version, 5.8.5 is installed'. No CI job builds or runs web/backend, so the
breakage is invisible to CI -- it would only surface when a user runs
kbagent serve's Node BFF.

Bump the plugins in lock-step to their fastify-5 majors:
  @fastify/cors  ^9 -> ^11
  @fastify/static ^7 -> ^9

Verified locally end-to-end: npm ci clean, npm run build (tsc) clean with
fastify 5 types, BFF boots and registers both plugins, /__bff/health +
/__bff/info OK, live /api proxy to kbagent serve returns 34 projects,
CORS preflight returns 204 with the right ACAO header, and @fastify/static
serves the SPA + assets + SPA-fallback route.

Supersedes #342.
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 4 potential issues.

Open in Devin Review

Comment thread web/backend/package.json
"fastify": "^4.28.1",
"@fastify/cors": "^11.0.0",
"@fastify/static": "^9.0.0",
"fastify": "^5.8.5",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Unnamed wildcard route "/api/*" is incompatible with Fastify v5's find-my-way v9 router

The PR bumps fastify from v4 to v5 (web/backend/package.json:17), which ships with find-my-way v9 (lock file resolves to 9.6.0). In find-my-way v9, unnamed wildcard * is no longer valid — wildcards must be named (e.g., "/api/*path"). The existing route at web/backend/src/proxy.ts:58 uses the old "/api/*" syntax, which will cause an error at route registration (server startup). The source code was not updated alongside this major version bump.

Prompt for agents
The upgrade from Fastify v4 to v5 introduces a breaking change in the router (find-my-way v9): unnamed wildcard routes are no longer supported. The route in web/backend/src/proxy.ts:58 uses app.all("/api/*", ...) which needs to be updated to use a named wildcard, e.g. app.all("/api/*path", ...). Additionally, check for other Fastify v5 breaking changes that may affect server.ts and proxy.ts — in particular the @fastify/static v9 API (the wildcard: false option at server.ts:50 may have been removed or renamed), and verify that direct reply.raw.writeHead() usage in proxy.ts:42 is still supported with Fastify v5's response lifecycle.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread web/backend/package.json
"@fastify/static": "^7.0.4",
"fastify": "^4.28.1",
"@fastify/cors": "^11.0.0",
"@fastify/static": "^9.0.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 @fastify/static v9 'wildcard' option may be removed or renamed

At web/backend/src/server.ts:50, the code passes wildcard: false to @fastify/static. This option controlled whether the plugin registers a wildcard route for serving files. With the jump from @fastify/static v7 to v9 (two major versions), this option may have been removed, renamed, or its behavior changed. If removed, Fastify v5 may silently ignore it or throw — either way the SPA file-serving behavior could change. This should be verified against the @fastify/static v9 migration guide or changelog.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread web/backend/package.json
"fastify": "^4.28.1",
"@fastify/cors": "^11.0.0",
"@fastify/static": "^9.0.0",
"fastify": "^5.8.5",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Direct reply.raw.writeHead() usage may conflict with Fastify v5 response lifecycle

In web/backend/src/proxy.ts:42, the SSE streaming function calls reply.raw.writeHead(200, {...}) directly, bypassing Fastify's response abstraction. Fastify v5 made changes to response lifecycle tracking — using reply.raw directly can conflict with Fastify's internal state, potentially causing 'Reply already sent' warnings or errors. The streamSSE function at proxy.ts:38-52 should be reviewed to ensure it's compatible with Fastify v5's stricter response handling. Consider using reply.hijack() before writing to reply.raw to signal Fastify that the response is being handled manually.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread web/backend/package.json
Comment on lines +15 to +17
"@fastify/cors": "^11.0.0",
"@fastify/static": "^9.0.0",
"fastify": "^5.8.5",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚩 Three simultaneous major version bumps with no code changes

This PR bumps three packages across major versions (fastify 4→5, @fastify/cors 9→11, @fastify/static 7→9) but includes zero source code changes. Major version bumps indicate breaking API changes by semver convention. The lock file confirms these are real upgrades (e.g., fastify resolved to 5.8.5, find-my-way to 9.6.0). At minimum, the PR should include evidence that the code was tested against the new versions (e.g., test output, manual verification notes), or the source should be updated to use the new APIs. Without either, this PR risks shipping a broken backend.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@padak padak merged commit c72cb78 into main May 25, 2026
3 checks passed
@padak padak deleted the chore/bump-backend-fastify5 branch May 25, 2026 19:37
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.

1 participant