Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

353
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda