2

Posting this to help others with this issue, answer below

Issue: We are using Sitecore 10.2 headless on Vercel. On our Edge environment, Rich Text fields that are returned by GraphQL are returning /notfound urls for all internal links. This is only happening on Edge, not on our lower environments. The layoutservice API (/sitecore/api/layout/render) shows the internal links with the correct URLs (<a href=\"/mypage\">My Page</a>); it shows correctly in the GraphQL playground (/sitecore/api/graph/edge/ui) as well (<a href=\"https://my-vercel-url.com/mypage\">); but on our actual page on https://my-vercel-url.com, it renders as "/sitecore/service/notfound.aspx?item=%7b33DB4E97-C5C0-452B-83C3-8FE5FB086E25%7d%40en". This is happening for all internal links, and the linked page is published.

1 Answer 1

2

Official answer from Sitecore:

We have reproduced a similar behavior where the links were incorrectly resolved as "/sitecore/service/notfound.aspx". We created a related bug, with public reference number 570892. More information about public reference numbers can be found here: https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0853187

The issue happens when the GraphQL queries sent to Edge use "value", for example:

query {
    item(path: "/sitecore/content/home", language: "en") {
        field(name: "text") {
            value
        }
    }
}

However, if the "jsonValue" is used, the links will be resolved correctly:

query {
    item(path: "/sitecore/content/home", language: "en") {
        field(name: "text") {
            jsonValue
        }
    }
}

This is because the pipelines to resolve values are all run for jsonValue but not for value. From the documentation: "The various Sitecore Headless SDKs all contain helpers for rendering field values. These helpers assist with rendering complex fields (such as images or links) and editable values in the context of inline editing. Item fields in the Experience Edge schema include jsonValue that outputs the field in a format compatible with these field helpers"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.