Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

352
Views
Gatsby sitemap: GraphQLError: Syntax Error: Expected Name, found <EOF>

I've been trying to get the gatsby sitemap plugin to work for awhile now and I cannot figure out what I'm doing wrong here. First I couldnt pull the site.siteMetadata.siteTitle so I had to set it with a function. Now, I'm having trouble getting pages added to the sitemap. Yes, I've tested the query in Graphiql multiple times and it works.

I am getting the following error and below it is my sitemap config (just trying to get the pages to work for now):

"gatsby-plugin-sitemap" threw an error while running the onPostBuild lifecycle:

Syntax Error: Expected Name, found <EOF>.

  40 |             output = _ref2.output, entryLimit = _ref2.entryLimit, query = _ref2.query, excludes =
_ref2.excludes, resolveSiteUrl = _ref2.resolveSiteUrl, resolvePagePath = _ref2.resolvePagePath,
resolvePages = _ref2.resolvePages, filterPages = _ref2.filterPages, serialize = _ref2.serialize;
  41 |             _context.next = 4;
> 42 |             return graphql(query);
     |                    ^
  43 |
  44 |           case 4:
  45 |             _yield$graphql = _context.sent;

File: node_modules/gatsby-plugin-sitemap/gatsby-node.js:42:20
{
      resolve: `gatsby-plugin-sitemap`,
      options: {
        query: `{
          site {
          siteMetadata {
            siteUrl
          }
        }
        allSitePage {
          nodes {
            path
          }
        }
        allMarkdownRemark {
          edges {
            node {
              frontmatter {
                slug
              }
            }
          }
        }`,
        resolveSiteUrl: siteUrl,
        resolvePages: ({ allSitePage: {nodes: allPages} }) => {
          return allPages.map(page => {
            return { ...page }
          })
        },
        serialize: ({ path }) => {
          return {
            url: path,
            priority: 0.7,
          };
        },
      },
    },

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I think you are missing a } at the end of your query:

{
      resolve: `gatsby-plugin-sitemap`,
      options: {
        query: `{
          site {
            siteMetadata {
              siteUrl
            }
          }
          allSitePage {
            nodes {
              path
            }
          }
          allMarkdownRemark {
            edges {
              node {
                frontmatter {
                  slug
                }
              }
            }
          }
        }`,
        resolveSiteUrl: siteUrl,
        resolvePages: ({ allSitePage: {nodes: allPages} }) => {
          return allPages.map(page => {
            return { ...page }
          })
        },
        serialize: ({ path }) => {
          return {
            url: path,
            priority: 0.7,
          };
        },
      },
    },

Because the query object it's not properly formatted, it throws the syntax (<EOF>, end-of-file) exception.

The rest should work alone.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!