-
Notifications
You must be signed in to change notification settings - Fork 125
Closed
Labels
Description
Version
Reproduction link
https://github.com/miteyema/nuxt-sitemap-now
Steps to reproduce
- I have an api serverless function to return the dynamic routes so I can build a complete sitemap
- The dynamic routes are added to nuxt generate, so they are available for the sitemap module
- SRR app works in dev mode, but once deployed with zeit now in production (using nuxt/now-builder), it's not working
- If I use nuxt generate (to make a static app), sitemap does work
This is the config object for sitemap in nuxt.config.js:
sitemap: {
hostname: baseURL,
defaults: {
lastmod: new Date(),
changefreq: 'weekly',
priority: 0.8
}
}
The generate part in nuxt.config.js:
generate: {
async routes() {
const response = await axios.get('routes', {
// FYI: generate will always be in production mode
baseURL: apiBaseURL
})
const dynamicRoutes = response.data
return dynamicRoutes
}
}
What is expected ?
sitemap.xml is shown
What is actually happening?
"Nuxt.js Internal Server Error" is show with status code 500.
The following log is shown on the server:
ERROR Cannot read property 'filter' of null
at node_modules/@nuxtjs/sitemap/lib/routes.js:14:21
at Array.forEach (<anonymous>)
at excludeRoutes (node_modules/@nuxtjs/sitemap/lib/routes.js:11:12)
at Object.cache.staticRoutes (node_modules/@nuxtjs/sitemap/lib/middleware.js:48:30)
at AsyncCache.load [as _load] (node_modules/@nuxtjs/sitemap/lib/cache.js:19:68)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
JSandmark and Youhan