Gatsby: [gatsby-plugin-sitemap] Netlify Build results in query error

Created on 7 Oct 2019  路  4Comments  路  Source: gatsbyjs/gatsby

Description

I'm publishing my site onto Netlify, and continously get the errors

error #11321 PLUGIN Cannot query field "siteUrl" on type "SiteSiteMetadata"
GraphQL request:5:11
4 |    siteMetadata {
5 |        siteUrl
  |        ^
6 |    }

"gatsby-plugin-sitemap" threw an error while running the onPostBuild lifecycle:
Error: Cannot query field "siteUrl" on type "SiteSiteMetadata".
GraphQL request:5:11
4 |    siteMetadata {
5 |        siteUrl
  |        ^
6 |    }
     - internals.js:27
     [/repo]/|gatsby-plugin-sitemap]/internals.js:27:13

Steps to reproduce

Clone https://gitlab.com/HenrikFalck/portfolio.git and publish to Netlify. Further down the deploy log you'll see the same errors.

Expected result

The deploy shouldn't fail.

Actual result

error #11321 PLUGIN Cannot query field "siteUrl" on type "SiteSiteMetadata"
GraphQL request:5:11
4 |    siteMetadata {
5 |        siteUrl
  |        ^
6 |    }

"gatsby-plugin-sitemap" threw an error while running the onPostBuild lifecycle:
Error: Cannot query field "siteUrl" on type "SiteSiteMetadata".
GraphQL request:5:11
4 |    siteMetadata {
5 |        siteUrl
  |        ^
6 |    }
     - internals.js:27
     [/repo]/|gatsby-plugin-sitemap]/internals.js:27:13

I've never encountered this problem before, and I haven't fiddled around with any metadata requests, so I'm not too sure what to do about this.

Environment

System:
    OS: macOS 10.15
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 10.13.0 - /usr/local/bin/node
    Yarn: 1.19.0 - ~/.yarn/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 78.0.3904.44
    Safari: 13.0.1
  npmPackages:
    gatsby: ^2.15.28 => 2.15.28
    gatsby-image: ^2.2.23 => 2.2.23
    gatsby-plugin-facebook-pixel: ^1.0.3 => 1.0.3
    gatsby-plugin-google-analytics: ^2.1.19 => 2.1.19
    gatsby-plugin-manifest: ^2.2.20 => 2.2.20
    gatsby-plugin-offline: ^2.2.10 => 2.2.10
    gatsby-plugin-react-helmet: ^3.1.10 => 3.1.10
    gatsby-plugin-sass: ^2.1.17 => 2.1.17
    gatsby-plugin-sharp: ^2.2.27 => 2.2.27
    gatsby-plugin-sitemap: ^2.2.16 => 2.2.16
    gatsby-source-filesystem: ^2.1.28 => 2.1.28
    gatsby-source-wordpress: ^3.1.38 => 3.1.38
    gatsby-transformer-sharp: ^2.2.19 => 2.2.19
  npmGlobalPackages:
    gatsby-cli: 2.7.44
    gatsby-plugin-manifest: 2.2.15
    gatsby-plugin-offline: 2.2.10
    gatsby-plugin-sitemap: 2.2.11
    gatsby: 2.15.11

Most helpful comment

Fixed

Add siteUrl: [your-url] to gatsby-config.js.

All 4 comments

Fixed

Add siteUrl: [your-url] to gatsby-config.js.

@henrikfalck it's not working for me. If I make a direct query on __graphql, the site does not exist within allSitepage, can you help me?

@decarvelholucas Sure thing!

More specifically, add siteUrl as a field into siteMetadata in gatsby-config.js, not a top level field

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benstr picture benstr  路  3Comments

3CordGuy picture 3CordGuy  路  3Comments

KyleAMathews picture KyleAMathews  路  3Comments

kalinchernev picture kalinchernev  路  3Comments

ghost picture ghost  路  3Comments