If that works on local and not on Vercel, then I suspect its related to configuration (as you said). Here are details of how its implementation uses configuration and you can check those.
With SXA setup, you get a sitemap-fetcher
plugin. It resides at path - src\rendering\src\lib\sitemap-fetcher\plugins\graphql-sitemap-service.ts
If you check its constructor -
constructor() {
this._graphqlSitemapService = new GraphQLSitemapService({
endpoint: config.graphQLEndpoint,
apiKey: config.sitecoreApiKey,
siteName: config.jssAppName,
});
Assuming you are using GraphQl endpoint, you will need to share AppName if you have multisite setup in environment variables.
Second thing to look at is it's implementation,
async exec(context?: GetStaticPathsContext): Promise<StaticPath[]> {
if (process.env.JSS_MODE === constants.JSS_MODE.DISCONNECTED) {
return [];
}
return process.env.EXPORT_MODE
? this._graphqlSitemapService.fetchExportSitemap(config.defaultLanguage)
: this._graphqlSitemapService.fetchSSGSitemap(context?.locales || []);
}
If you have multilingual setup, you can check your default language (in config.json
).
If this is all well then you can check if GraphQl query returns Sitemap.
EDIT 1 -
If you are using Experience Edge, you will need to store Sitemap in Media Item (This is recommended for Cloud version but no harm in trying).
https://doc.sitecore.com/xmc/en/developers/xm-cloud/configure-a-sitemap.html
And make sure that you have media folder selected in Site Item's Sitemap media items
field -