I’m gonna start this off with the whole “I’m not an expert…” deal. Because frankly, I’m not an expert when it comes to Experience Edge. It’s relatively new. And I am too. Glad we got that part out of the way. So what’s the deal?
Well, we were working on a new site and for some reason, any request to the site was giving a 404. We had set all the correct keys, URLs, everything. But nothing. Ever. Resolved. I decided to pop on over to Postman and see what Edge was returning. I was…a little surprised.
Here’s the query I ran:
query {
layout(site: "SITENAME", routePath: "/", language: "en") {
item {
rendered
}
}
}
Even if you’re new here, you can probably figure out that’s what you’d send to get the JSON data for the home item of the named site. Easy enough? That’s like 101 level stuff. Here’s what I expected to get back:
"data": {
"layout": {
"item": {
"rendered": {
"sitecore": {
"context": {
"pageEditing": false,
"site": {
"name": "SITENAME"
},
"pageState": "normal",
"language": "en",
"itemPath": "/"
},
...
...
...
...
What did I get back? This:
"data": {
"layout": {
"item": {
"rendered": {
"sitecore": {
"context": {
"pageEditing": false,
"site": {
"name": "website"
},
"pageState": "normal",
"language": "en",
"itemPath": "http://PUBLIC_URL.vercel.app/"
},
...
...
...
...
Something is….not right. Looking at you, lines #9 and #13
So this makes sense. If you were trying to publish a site without a site definition, it’s going to end up going to website by default. That’s like a Sitecore 6 thing. How did we get here? You could ask my dog, Rom, and he’d have about as much insight as I did. He also barks at the dog on the side of the bag of dog food, so I’m not going to cite him as a reliable source. I decided to ping someone more reliable in the SC Community. Their response contained some of the most unsettling dev words possible “Interesting” and “I’ve never seen this.” Oye. Ok, so off to Sitecore Support Land!
One of the things Sitecore had me check was to see if my sites were actually in Edge. How do you do that? Here’s a query for you:
query {
site {
siteInfoCollection {
name
rootPath
}
}
}
Which yielded the following:
{
"data": {
"site": {
"siteInfoCollection": [
{
"name": "website",
"rootPath": "/sitecore/content"
},
{
"name": "SITENAME",
"rootPath": "/sitecore/content/<Tenant>/<Site>"
}
]
}
}
}
Good news here is that this looks normal. Why does the order show up like that…No idea. But, this is how it was in our other environment, and that environment was working fine.
Anyway, support needed some time to take a look at this. They did find the issue, luckily, but I’ve been told the diagnosis was complicated and required some custom logging put in to track this down. I’m not saying support put a “Write-Line ‘HERE!'” every five lines, but it could happen. Normal people do that. All the time, right? Glad we’re on the same page.
So what was the culprit? Well, it’s not what you’d expect. Apparently our Site Definition in our SXA site was updated and someone unchecked “Enable preview”
How would that end up breaking the entire site resolution? That’s another great question for Rom, honestly. I don’t have a clue. The folks on support have created a bug for this (#591346), which is nice to know it’s not the intended behavior. Once we checked the box again (and really, you should be checking all the boxes…one of the other ones disabled Experience Editor for your rendering host), did a full purge of the content from Edge, did a full republish, things were back on track. This was a “fun” one for sure. One question you’d probably ask is…does this change the data returned from the query? If you’re talking about the one that lists the sites…no. That looks the same. The one for the rendering of the home item? That works now!