Skip to content

refactor: adapter entry#331

Merged
lazarv merged 3 commits intomainfrom
refactor/adapter-entry
Mar 3, 2026
Merged

refactor: adapter entry#331
lazarv merged 3 commits intomainfrom
refactor/adapter-entry

Conversation

@lazarv
Copy link
Owner

@lazarv lazarv commented Mar 3, 2026

Extracts the duplicated request handling logic from all adapter-generated entry files into a single shared module (adapters/shared/edge-handler.mjs), eliminating ~450 lines of copy-pasted code across 10 deployment adapters.

Motivation

Every adapter (AWS, Azure, Azure SWA, Bun, Cloudflare, Deno, Docker, Firebase, Netlify Edge, Netlify Node) and the default edge entry had their own independent copy of the same core logic:

  • Lazy initialization of the reactServer() instance
  • HTTP context creation via createContext()
  • 404 response handling when response is null
  • set-cookie header propagation from httpContext._setCookies
  • Error catching with 500 response fallback

This duplication meant that any behavioral change or bug fix had to be replicated across 10+ files, making maintenance error-prone.

@cloudflare-workers-and-pages
Copy link

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
react-server-docs 5b33503 Mar 03 2026, 10:26 PM

@codecov-commenter
Copy link

codecov-commenter commented Mar 3, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
340 1 339 6
View the top 3 failed test(s) by shortest run time
__test__/http-context.spec.mjs > http cookies
Stack Traces | 9.13s run time
AssertionError: expected { connection: 'keep-alive', …(7) } to match object { Object (set-cookie) }
(7 matching properties omitted from actual)

- Expected
+ Received

  {
-   "set-cookie": "cookie-name=cookie-value",
+   "set-cookie": "cookie-name=cookie-value-update
+ cookie-name=cookie-value-update",
  }

 ❯ __test__/http-context.spec.mjs:88:39
__test__/apps/docs.spec.mjs > docs load
Stack Traces | 128s run time
TimeoutError: page.goto: Timeout 30000ms exceeded.
Call log:
  - navigating to "http://localhost:11925/", waiting until "load"

 ❯ __test__/apps/docs.spec.mjs:10:14
__test__/deno.spec.mjs > preset: get-started-ts
Stack Traces | 300s run time
Error: Hook timed out in 300000ms.
If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
 ❯ __test__/deno.spec.mjs:46:18

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@lazarv lazarv merged commit 0f76cb9 into main Mar 3, 2026
99 of 100 checks passed
@lazarv lazarv deleted the refactor/adapter-entry branch March 3, 2026 23:24
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