question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Nuxt.js Internal Server Error when using @nuxtjs/sitemap

See original GitHub issue

Hi, I am using @nuxtjs/sitemap in my project which is working perfectly in dev environment but after deploying to now when I visit mysite.com/sitemap.xml I see Nuxt.js Internal Server Error on the browser and on the Zeit Now Runtime Log I see:

ERROR  Cannot read property 'map' of null

  at joinRoutes (node_modules/@nuxtjs/sitemap/lib/cache.js:76:31)
  at AsyncCache.load [as _load] (node_modules/@nuxtjs/sitemap/lib/cache.js:19:18)

Duration: 7.37 ms  Billed Duration: 100 ms  Memory Size: 3008 MB  Max Memory Used: 238 MB	

I have Googled a lot but couldn’t find any solution to this. Can anyone please help?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

16reactions
MarvinMilescommented, Oct 24, 2019

@nuxtjs/sitemap module writes sitemap-routes.json file into nuxt dist directory during build process:

Screen Shot 2019-10-24 at 3 54 20 AM

But currently nuxt`s now-builder ignores external files outside ‘client’ and ‘server’ folders. So you have to add path to sitemap-routes.json manually.

@isaumya Just add "./.nuxt/dist/sitemap-routes.json" to serverFiles array in your now.json config file than your issue will be fixed:

"builds": [
    {
      "src": "nuxt.config.js",
      "use": "@nuxtjs/now-builder",
      "config": {
        "serverFiles": [
          "./.nuxt/dist/sitemap-routes.json"
        ]
      }
    }
  ]

In case you use custom buildDir, use "./YOUR_BUILD_DIR/dist/sitemap-routes.json" instead.

1reaction
isaumyacommented, Oct 24, 2019

@MarvinMiles Thank you so much for looking into this and providing the solution. I have just now tested and can confirm that the sitemap is running perfectly and not returning any Internal Server Error. Thanks again for the help. 😊

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nuxt Sitemap Internal Server Error on Vercel - Stack Overflow
I want to create a sitemap for my SSR Nuxt project. I'm using the '@nuxtjs/sitemap' module for creating my sitemap.
Read more >
Sitemap.xml on a Nuxt site - Issues - Edgio Community Forums
Deployed a nuxt site to the XDN and trying to serve my sitemap, receiving the following error: None of the specified routes in...
Read more >
Nuxt.js Dynamic Sitemap and Feed for Static Websites - Medium
I have a portfolio website that has blog pages and other common things that a website has. When using CMS like WordPress or...
Read more >
Change the Nuxt.js server error page - Alexander Lichter's blog
No problem! You can do this through your nuxt.config.js . The text for the default error pages is extracted from the message object....
Read more >
Nuxt Sitemap Module: Introduction
Module based on the awesome sitemap.js package ❤️. Create sitemap or sitemap index. Automatically add the static routes to each sitemap.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found