Gatsbyjs-plugin-sitemap fails during build

answered
#1

Hello,

I am trying to publish my first gatsbyjs site on Netlify (linked to github repository). I have problems with gatsby-sitemap plugin. Building on Netlify fails with the following error:

10:06:58 PM: success Building production JavaScript and CSS bundles — 32.389 s
10:07:00 PM: success Building static HTML for pages — 1.819 s — 13/13 40.65 pages/second
10:07:00 PM: error Plugin gatsby-plugin-sitemap returned an error
10:07:00 PM:
10:07:00 PM: Error: Syntax Error: Expected Name, found {
10:07:00 PM: GraphQL request (4:31)
10:07:00 PM: 3: site {
10:07:00 PM: 4: siteMetadata: {
10:07:00 PM: ^
10:07:00 PM: 5: siteUrl: “https://www.example.com”,
10:07:00 PM:
10:07:00 PM: - internals.js:27
10:07:00 PM: [repo]/[gatsby-plugin-sitemap]/internals.js:27:13
10:07:00 PM:
10:07:00 PM:
10:07:00 PM: error Command failed with exit code 1.
10:07:00 PM: info Visit xxxx (replaced to be able to post this topic) about this command.
10:07:00 PM: Error running command: Build script returned non-zero exit code: 1
10:07:00 PM: Failing build: Failed to build site
10:07:01 PM: failed during stage ‘building site’: Build script returned non-zero exit code: 1
10:07:01 PM: Finished processing build request in 2m16.538153435s
10:07:01 PM: Shutting down logging, 0 messages pending

Strangely I got it working once (very first time) - I replaced " (quotations marks) with ` (weird apostrophe), but now even that does not work.

When running gatsby develop on my local machine, " are fine, but ` is rejected :astonished:

My live site: https://kind-lumiere-377aac.netlify.com/

I guess it is related more to netlify than to the plug-in but I may be wrong.

The plug-in docs is on gatsby site url + packages/gatsby-plugin-sitemap/?=sitemap (sorry for missing link, only 2 links are allowed for new users).

Any ideas for fix are welcome :sunglasses:

#2

Hi @jjosseff

Welcome to our Community!

Another user reported a very similar error, and told us this solution worked for them: https://github.com/alxshelepenok/gatsby-starter-lumen/issues/199

Not sure if this is the same issue your are facing? Let us know if this helps.

#3

Hi @laura

Thanks for nice welcome :+1: and thank you for pointing me in the right direction. Good news for Netlify developers - I have found out that the error replicates on my local machine as well so nothing to do with Netlify :wink:

1 Like