fix: replace unreliable httpbin.org with www.aem.live in edge-action fixture#100
fix: replace unreliable httpbin.org with www.aem.live in edge-action fixture#100trieloff wants to merge 2 commits into
Conversation
…fixture The Fastly test service does not have httpbin.org registered as a backend, causing all integration tests on main to fail with: 500 Error: Requested backend named 'httpbin.org' does not exist Replace the four backend fetches in the edge-action fixture with https://www.aem.live/, which is reliably reachable from the Fastly deploy-test service, and use the content-length header instead of the JSON uuid for response validation. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Signed-off-by: Lars Trieloff <lars@trieloff.net>
The Fastly deploy-test service does not have backends pre-registered for arbitrary hostnames. Drop the explicit `backend:` option from each fetch call so @adobe/fetch's polyfill can register backends dynamically at runtime, matching the pattern that works on side branches. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> Signed-off-by: Lars Trieloff <lars@trieloff.net>
|
This PR will trigger a patch release when merged. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR updates the Compute@Edge test fixture to stop using the httpbin.org backend (which is not registered on the deploy-test Fastly service) and instead uses www.aem.live so the integration test can run reliably again.
Changes:
- Replaced
httpbin.orgbackend fetches withhttps://www.aem.live/+ backend namewww.aem.live. - Switched response-derived output from
uuid(JSON) tocontent-lengthheader reporting. - Simplified the “status code test” fetch to use the new backend without logging the response body.
Comments suppressed due to low confidence (1)
test/fixtures/edge-action/src/index.js:53
- The comment describes an "Original status code test", but the code no longer varies the backend request by status code and simply fetches a fixed URL. Consider updating the wording to reflect what is actually being exercised (a basic backend fetch/smoke test) to avoid confusion for future maintainers.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const cacheOverride = new CacheOverride('override', { ttl: 3600 }); | ||
| const backendResponse = await fetch('https://httpbin.org/uuid', { | ||
| backend: 'httpbin.org', | ||
| cacheOverride, | ||
| }); | ||
| const data = await backendResponse.json(); | ||
| return new Response(`(${context?.func?.name}) ok: cache-override-ttl ttl=3600 uuid=${data.uuid} – ${backendResponse.status}`); | ||
| const backendResponse = await fetch('https://www.aem.live/', { cacheOverride }); | ||
| const contentLength = backendResponse.headers.get('content-length') || 'unknown'; | ||
| return new Response(`(${context?.func?.name}) ok: cache-override-ttl ttl=3600 size=${contentLength} – ${backendResponse.status}`); | ||
| } | ||
|
|
There was a problem hiding this comment.
In these CacheOverride routes the backend response body is never consumed/cancelled (unlike the fallback route which calls await backendresponse.text()). Leaving the body unread can keep the underlying stream open and may cause unnecessary resource usage in the edge runtime. Consider draining or cancelling the body after reading headers (or compute the size from the consumed body instead of relying on content-length).
| return new Response(`(${context?.func?.name}) ok: cache-override-pass mode=pass size=${contentLength} – ${backendResponse.status}`); | ||
| } | ||
|
|
||
| if (path.includes('/cache-override-key')) { | ||
| // Test: Custom cache key | ||
| const cacheOverride = new CacheOverride({ ttl: 300, cacheKey: 'test-key' }); |
There was a problem hiding this comment.
Same as above: the response body isn't drained/cancelled before returning. To avoid holding open streams in the edge runtime, consume or cancel the response body (or derive size from the consumed body).
| // Original status code test - use reliable backend. | ||
| console.log(req.url, 'https://www.aem.live/'); | ||
| const backendresponse = await fetch('https://www.aem.live/'); | ||
| await backendresponse.text(); | ||
| return new Response(`(${context?.func?.name}) ok: ${await context.env.HEY} ${await context.env.FOO} – ${backendresponse.status}`); | ||
| } |
There was a problem hiding this comment.
Same issue here: the backend response body is not consumed/cancelled before returning. Consuming or cancelling the body helps ensure connections/streams are released promptly (and would also let you compute size deterministically without depending on the content-length header).
tripodsan
left a comment
There was a problem hiding this comment.
drain the test request, as copilot suggests.
Problem
The integration test on
main(and every renovate / feature PR rebased on it) has been failing since 2025-11-26 with:The deploy-test Fastly service does not have
httpbin.orgregistered as a backend, so theedge-actionfixture's runtime fetches return 500.This blocks (in turn) PR #99 (
@adobe/helix-deployv14 peer-dep bump), which in turn blocks downstream consumers likeadobe/helix-rum-collector#623.Fix
Replace the four
httpbin.orgbackend fetches intest/fixtures/edge-action/src/index.jswithhttps://www.aem.live/, mirroring the change already made on side-branches (commit e1c642e). Switch response validation fromdata.uuid(JSON) to thecontent-lengthheader, sincewww.aem.liveis HTML.The integration test assertions (
ttl=3600,mode=pass,cacheKey=test-key,cache-override-*route names) are unchanged and remain satisfied by the new fixture output.Verification
Lint passes for the touched file (existing
no-consolewarning preserved as-is to match the rest of the fixture). The fix has already been validated upstream onfeat/esbuild-bundlerandreplace-dictionary-with-secretstore-configstorebranches.Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>