-
Notifications
You must be signed in to change notification settings - Fork 0
Development Notes
-
In this repo the Content API Service Endpoint is implemented as a Cloudflare Worker and it is deployed as
sites-content-api.adobeaem.workers.dev -
The XWalk Renderer is at https://github.com/adobe-rnd/xwalk-renderer-poc and is deployed to Cloudflare as
xwalk-renderer-poc.adobeaem.workers.dev -
⚠️ For this use case, only/pages/byUrl?url=<url>and/pages/<pageId>/contentof the Content API are needed and implemented -
⚠️ sites-content-api.adobeaem.workers.devkeeps a development token in its secret store in order to be able to access the AEM instance. This token is only 24h valid. This needs to be changed to a TECC based service account approach. -
✅ Fetching the content of the page via
/_jcr_id/<UUID>.6.jsonworks, thus query builder is not needed -
🛑 ✅ to render HTML for /pages//content in the context of Edge Delivery Services we need the JSON models from UE in order to determine the sequencing of the properties to render. This is tricky as we would need the "external" Edge Delivery Services URL of a page/project.
this is solved: When a block is edited via UE, the modelFields property is written. It is needed to determine the sequence of processing the relevant props, e.g.
modelFields: [image,text]means, image comes before text. -
⚠️ ✅ Passthrough 400, 401 Errors on AEM to caller not implemented, e.g. when token Content API -> AEM has expired. -
⚠️ determineAemSiteNameBySiteId() (see 1️⃣) returns the aemSiteName for a given siteId (which is the jcr:uuid of the site node). This will be resolved on each render request. A performance optimization could be:- look in your cache if a mapping for a given siteId exists
- if it exists, serve it, otherwise do lookup via querybuilder & populate the cache
- if 2️⃣ fails with served cache entry:
- invalidate mapping entry
- do a lookup via querybuilder
- repopulate the cache with new siteId->aemSiteName entry
- try 2️⃣ again
-
❓ How can the edge based content API Impl be behind the API router?
💡 The /pages endpoint will be bucketed: for production the endpoint will be:
author-p<programId>-e<envId>.adobeaemcloud.com/adobe/pagesFor the time being, it is published under an experimental endpoint:
author-p<programId>-e<envId>.adobeaemcloud.com/adobe/experimental/aspm-expires-20251231/pagesThe API router is able to route all bucketed requests that have the path /adobe/pages to the same Cloudflare Worker. The Cloudflare Worker receives a request on the /adobe/pages path. The X-ADOBE-ROUTING header contains the program and environment information (eg. program=1234,environment=567) so that it can deduce which AEM authoring instance (also bucketed) to query.
-
❓ How does the function know about the AEM context aka. Author endpoint.
💡 The XWalk Renderer will need to extract the program and env information from the XwalkPageId. This is specified in the fstab.yaml and determines the mountpoint. The new mountpoint will be of shape:
https://xwalk-renderer.adobeaem.workers.dev/xwalkpages/130360:1272151:1534567d-9937-4e40-85ff-369a8ed45367/main programId------------^ envId------------------------^ siteId (AEM jcr:uuid)--------------------------^ branch ------------------------------------------------------------------^ -
ℹ️ Example
fetchHtmlUrlrequests:1️⃣
https://xwalk-renderer-poc.adobeaem.workers.dev/xwalkpages/130360%3A1272151%3A1534567d-9937-4e40-85ff-369a8ed45367/main/index.htmlthis will be mapped internally to a new request:
2️⃣
https://author-p130360-e1272151.adobeaemcloud.com/adobe/experimental/aspm-expires-20251231/pages/byUrl?url=https%3A%2F%2Fxwalk-renderer-poc.adobeaem.workers.dev%2Fxwalkpages%2F130360%3A1272151%3A1534567d-9937-4e40-85ff-369a8ed45367%2Fmain%2Findex.html'Response:
{ "id":"22f28cd6-d6b1-40c2-abee-7461a7cbacc8", "siteId":"1534567d-9937-4e40-85ff-369a8ed45367", "title":"Index", "created": { "at":"Sun Apr 13 2025 20:25:56 GMT+0000", "by":"terinmez@adobe.com" }, "modified": { "at":"Sun Apr 13 2025 20:54:44 GMT+0000","by":"terinmez@adobe.com"}, "path":"index" }3️⃣
https://author-p130360-e1272151.adobeaemcloud.com/adobe/experimental/aspm-expires-20251231/pages/22f28cd6-d6b1-40c2-abee-7461a7cbacc8/contentResponse:
<!DOCTYPE html> <html> <head> <title>Index</title> </head> <body> <header></header> <main> <div> <div class="hero"></div> </div> <div> <h1>Lorem Ipsum</h1> <p>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...<br>There is no one who loves pain itself, who seeks after it and wants to have it, simply because it is pain... Tanju was here ...</p> </div> <div></div> <div> <h1>Boilerplate Highlights?</h1> <p>Find some of our favorite staff picks below:</p> <div class="cards"></div> </div> </main> <footer></footer> </body> </html>