Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

351
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda