Is anyone able to use wixSiteFrontend.routerSitemap()?

I used to have the following code:

import wixSite from ‘wix-site’;

await wixSite.routerSitemap(‘my-router’);

This code worked for years, until recently. My client emailed me a couple of weeks ago to ask why the table of contents wasn’t showing up for one of our pages. Upon inspection, I saw that the routerSitemap code was no longer working.

At some point, Wix seems to have split the APIs for wixSite into a frontend and backend API. The frontend API still contains the method routerSitemap(‘router-page’). I modified the imports and code to reflect the new API, thinking that this was the obvious culprit. But when you call that method, it never returns. I have put logging in to verify that the line before this call is being executed, but nothing after the call is executed. The code after the await or inside a then block never executes.

Strangely enough, the same code works fine in Preview Mode. But when I publish and look at the live site, it crashes somewhere outside of my own code.

Again, to be clear. I have changed from wixSite to wixSiteFrontend, but that doesn’t seem to be the problem. Even with the code:

const sitemapEntries = await wixSiteFrontend.routerSitemap(‘my-router’);
console.log(JSON.stringify(sitemapEntries);

// more code
console.log(‘code after the call to sitemapEntries’);

or

wixSiteFrontend.routerSitemap(‘my-router’).then((sitemapEntries) => {
console.log(JSON.stringify(sitemapEntries);
});

// more code
console.log(‘code after the call to sitemapEntries’);

the console.log messages after the call to sitemapEntries do not appear. All of the code leading up to the call executes. The code after the “then” executes. The code INSIDE the then block does not execute.

I must conclude that the server is processing the call to wixSiteFrontend.sitemapEntries, and it is bombing and never returning/resolving.

When I run the exact same code IN PREVIEW MODE, the code works as expected. It is only in PRODUCTION MODE that the code doesn’t work.

Product:
This is about Velo APIs

What are you trying to achieve:
I have a TOC page for all pages in the router. This page builds the TOC by calling wixSite.routerSitemap(). (now, it calls wixSiteFrontend.routerSitemap(‘my-router’))

What have you already tried:
I changed the code from importing the old wixSite to the new wixSiteFrontend. The code is supposedly the same (according to the docs). But it never returns in production mode. The same code returns the expected results in preview mode.

In order to get around this, I had to comment out the call and hardcode around it, manually creating a list of pages for that router. This is not sustainable. I need to be able to dynamically ask for, and receive, a list of pages controlled by the router. The way to do that until this broke, was to call routerSitemap.

Is anyone else having problems with wixSite? Is this a known issue? I’ve asked on the Discord channel, but no one from Wix ever seems to reply there, so…trying here on the developer forum instead.

Cheers