Gatsbyjs-plugin-sitemap fails during build



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: “”,
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:

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:


Hi @jjosseff

Welcome to our Community!

Another user reported a very similar error, and told us this solution worked for them:

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


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