Error on generating sitemap on staging & production

iggyvanlith
0
iggyvanlith
commented 4 months ago

I'm experiencing a problem in generating the sitemap. Everything works fine on localhost and the sitemap is generated properly but when I deploy my code to Heroku it stops working and I get this error (both on staging and production):

ERROR  Cannot read property 'get' of null
at handler (node_modules/@nuxtjs/sitemap/src/index.js:117:13)
at call (node_modules/connect/index.js:239:7)
at next (node_modules/connect/index.js:183:5)
at next (node_modules/connect/index.js:161:14)
at SendStream.error (node_modules/serve-static/index.js:121:7)
at SendStream.emit (events.js:182:13)
at SendStream.EventEmitter.emit (domain.js:442:20)
at SendStream.error (node_modules/send/index.js:270:17)
at SendStream.onStatError (node_modules/send/index.js:421:12)
at onstat (node_modules/send/index.js:727:26)
at FSReqWrap.oncomplete (fs.js:152:21)

So this would be in this file: https://github.com/nuxt-community/sitemap-module/blob/dev/src/index.js. And I guess it has something to do with the cache not being created?

I've removed all the settings and custom routes from the module so it's just included with this piece now:

modules: [
   ...more modules...
   ['@nuxtjs/sitemap'],
   ...more modules...
]

I've tried reproducing this error with a blank nuxt installation with just this module deploying to heroku but with no success (as in, a sitemap is properly generated). The problem is probably somewhere in my codebase but I'm not sure where to start looking.

Any idea where I should start to solve this error?

0
NicoPennec
1.3k
NicoPennec
commented 3 months ago

@iggyvanlith

I need more details to help you. Can you shared your sitemap config ?

notice that, if you use the SSR mode, you must not set the generated option at true.

0
iggyvanlith
0
iggyvanlith
commented 3 months ago

I removed all the setting from the sitemap config so there where no more settings than what I indicated in the first post.

So you also need the generated at true if you're using Universal SSR? I totally missed that, I thought it was only for when you wanted to generate a static page. It does work now, thank you for that!

How does it work then when I add pages to my website from my CMS? Does it regenerate the sitemap again automatically (after cache-time) or does it only update the sitemap when I run a new build?

0
Informations
Question โ€ข Unresolved
#c37 - Created 4 months ago