Conversation
…s the 503 red. head.html still decides whether a site exists, so a site not yet previewed on the requested ref is refused at 404 with its document already read and discarded. an upstream that cannot be reached still reports the failure in a return value, and a preview host that throws still reaches the browser as a 500 with no body. the full suite aborts on load, because src/storage/site.js does not exist yet.
…ce means head.html decided whether a site exists, so a site not yet previewed on the requested ref was refused at 404 with its document already read and discarded. config.aem.page answers both questions in one read: whether there is such a site, and which store holds its content. content.source.url is the field helix-admin sets x-api-upgrade-available from, so it is the boolean /ping conveyed. the /ping probe and HLX_ADMIN are gone. three upstreams reported a failure by returning a value, and two swallowed one. reach() names the upstream and rethrows a typed UpstreamError, and each route entry point catches once and builds the 503 its method takes. x-error names the upstream every time, not only on the site lookup. a 401 or 403 cannot be retried, so it is not a 503. neither is a 404. the preview host and the config store fall back on all three and log the refusal, and only a status that means no answer becomes an UpstreamError. a throw that is not an UpstreamError reaches the worker boundary, which logs it and answers 500. Relates to #258
…repo pins HLX_ADMIN goes out of all three environments: its only reader was the deleted /ping probe. dev points at dev/config-shim.js on 4713, which stands in for config.aem.page so the worker runs locally without the shared secret, and .gitignore gains the glob because npm start runs --env dev and wrangler reads .dev.vars.dev before .dev.vars. the deploy job had no npm ci, so wrangler-action installed its own default, 3.90.0, which has no secrets key and would deploy past a missing HLX_CONFIG_SERVICE_TOKEN. da-admin and da-collab install and run npm run deploy instead of using the action; this matches them. node 24, above the floor wrangler and miniflare declare.
…aration
v3 installs its own wrangler 3.90.0, which has no secrets key in its config
schema, so `secrets = { required = [...] }` is ignored and a deploy without
HLX_CONFIG_SERVICE_TOKEN goes out green. v4 defaults to wrangler 4.
same two lines as #214.
…nd the head red. the head arrives with the existence answer, so one pipeline read replaces the admin scope, and the source-bus flag comes off admin.hlx.page/ping again.
…t exists green. the pipeline scope answers existence and head.html in one read, so the admin scope goes, and with it the CDN token and api key metadata the worker was reading. a write asks /ping only.
red. header-absent-on-5xx read as legacy, which sends a source-bus write to da-admin where nothing serves it back.
the header is read ahead of the status, so the edge dictionary still answers for an origin that is rate limited. a refusal without it now throws.
red. /ping answers 200 with no header for a source-bus site in exactly that window, since helix-admin reads the same config and swallows the failure.
red. it answered with the store-did-not-answer text, and no store was asked.
the store answer comes from the same config, so an outage that hides one hides the other. a wrong store cannot be walked back from, and the 503 now names the destination as undetermined rather than the store as unreachable.
|
I think it was once decided that we don't need to support the case, where a DA project uses the new helix6 API for preview/publish, but still uses the DA storage. so, in order to simplify things, we don't need to read
|
|
Q for @tripodsan: not sure if it is too early for this PR but would it be ok to already only use https://api.aem.live and no admin.hlx.page any more? |
with #270 (comment), you don't need admin.hlx.page at all (exchange token should also work: |
|
config service pipeline scope now returns the contentSource (if it doesn't work for you, trigger a cache purge by changing the site config). eg: |
Co-authored-by: Tobias Bocanegra <tripod@bocanegra.ch>
Co-authored-by: Tobias Bocanegra <tripod@bocanegra.ch>
|
tested against stage (in sync with reads
writes
auth
|
Description
before
/head.htmldecided whether a site exists, so a site with no head.html on the ref was answered404: Unable to retrieve AEM branchback as that same 404
getPageTemplateswallowed a config store failure and answered the default template over adocument that exists
admin.hlx.page/pingnow
config.aem.pageatscope=pipelineanswers existence, head.html and the store.404 means no such site, any other non-200 is a 503
contentSource.urlnames the store. a config that names no store reads as legacy, and names thesite in a warning
UpstreamErrorandreach()insrc/utils/upstream.js: a read with no answer to use is a 503.the upstream is named in the body and in
x-error, and the author is told to retry or ask anadmin
where it used to go to da-admin
admin.hlx.pageis gone. the last call was the site token exchange insrc/routes/cookie.js,which hardcoded the host and now posts to
${env.AEM_API}/auth/adobe/exchangedev/lookup-shim.jsandnpm run dev:lookupsstand in for the config service locally[env.dev]now declaresHLX_CONFIG_SERVICE_TOKEN, without whichnpm run dev401s againstconfig.aem.page.
cloudflare/wrangler-actionv3 to v4, since v3's wrangler ignoressecrets.same two lines as chore(deps): update cloudflare/wrangler-action action to v4 #214
Related Issue
fixes #258. follows the review on #263.
Testing
live against config.aem.page, with the pre-change branch on a second port. the 404 body for a site
that does not exist changed on purpose, from
Not found: Unable to retrieve AEM branchto404: Site not found.contentSource: one read, routed tohttps://api.aem.live/{org}/sites/{site}/source/index.html. a legacy site: routed tohttps://admin.da.live/source/{org}/{site}/.... a site the config service does not know: 404contentSource: routed to da-admin, withnamed no content source, reading {org}/{site} as legacyin the logdoes not know: 404 in plain text, also before any store. a write to a legacy site that exists:
routed to
https://admin.da.live/source/{org}/{site}/.../gimme_cookieon a site behind Helix authentication: 200 with anauth_tokenand a 24 hoursite_token. on a site that needs no site token, the auth cookie alone. api.aem.live andadmin.hlx.page, asked in the same second, mint a byte-identical token
da-admin-localwas not running, and the editorconfig 503, which has unit tests only
dropping the second lookup from a write changed no routing. both trees ran 13 behaviours per scope
against a scripted config service, and of 169 outcome pairs none writes to a different store.
Risks
HLX_CONFIG_SERVICE_TOKENhas to be set onda-ueandda-ue-stagebefore the first deploy. thedeploy fails red without it.