Gatsby: pagequery throwing error

Created on 11 Aug 2019  路  2Comments  路  Source: gatsbyjs/gatsby

(I currently have a workaround using a separate component but not knowing why this is happening is really bugging me :)

Description

So I'm having a really tough time figuring out what's actually happening here but my index page query is throwing the error below.

Steps to reproduce

Unfortunately I can't link the demo project because I'm using a paid ui kit, however here's a gist of the file in question. Removing the pagequery 'fixes' it

https://gist.github.com/K-Kit/d33ed21dd7565d13a1daeb65f8b7f523

Expected result

The graphql query should execute normally.

Actual result

Error: It appears like Gatsby is misconfigured. Gatsby related `graphql` calls are supposed to only be evaluated at compile time, and then compiled away. Unfortunately, something went wrong and the query was left in the compiled code.

Unless your site has a complex or custom babel/Gatsby configuration this is likely a bug in Gatsby.

Environment

  System:
    OS: Windows 10
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Yarn: 1.17.3 - C:\Users\kyle\AppData\Roaming\npm\yarn.CMD
    npm: 6.9.2 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 2.7.16
  Browsers:
    Edge: 42.17134.1.0
  npmPackages:
    gatsby: ^2.13.57 => 2.13.57 
    gatsby-background-image: ^0.8.3 => 0.8.3 
    gatsby-cli: ^2.7.29 => 2.7.29 
    gatsby-image: ^2.2.8 => 2.2.8 
    gatsby-plugin-emotion: ^4.0.0 => 4.1.2 
    gatsby-plugin-facebook-pixel: ^1.0.3 => 1.0.3 
    gatsby-plugin-google-analytics: ^2.1.4 => 2.1.7 
    gatsby-plugin-google-tagmanager: ^2.1.4 => 2.1.5 
    gatsby-plugin-layout: 1.1.2 => 1.1.2 
    gatsby-plugin-manifest: ^2.2.3 => 2.2.5 
    gatsby-plugin-material-ui: ^2.1.4 => 2.1.5 
    gatsby-plugin-netlify: ^2.1.3 => 2.1.4 
    gatsby-plugin-netlify-cache: ^1.2.0 => 1.2.0 
    gatsby-plugin-offline: ^2.2.4 => 2.2.5 
    gatsby-plugin-react-helmet: ^3.0.6 => 3.1.3 
    gatsby-plugin-root-import: ^2.0.5 => 2.0.5 
    gatsby-plugin-sharp: 2.2.9 => 2.2.9 
    gatsby-plugin-sitemap: ^2.2.3 => 2.2.6 
    gatsby-source-filesystem: ^2.1.9 => 2.1.9 
    gatsby-source-shopify: 2.1.8 => 2.1.8 
    gatsby-transformer-sharp: ^2.1.8 => 2.2.6 

Most helpful comment

Remove the () brackets from the graphql function.

export const PageQuery = graphql`
query {
  imageSharp(original: {src: {regex: "/deeplogo/"}}) {
    fluid(quality: 60) {
      ...GatsbyImageSharpFluid
    }
  }
}
`

All 2 comments

Remove the () brackets from the graphql function.

export const PageQuery = graphql`
query {
  imageSharp(original: {src: {regex: "/deeplogo/"}}) {
    fluid(quality: 60) {
      ...GatsbyImageSharpFluid
    }
  }
}
`

Great catch! can't believe I missed that... Thanks @LekoArts

Was this page helpful?
0 / 5 - 0 ratings

Related issues

3CordGuy picture 3CordGuy  路  3Comments

mikestopcontinues picture mikestopcontinues  路  3Comments

benstr picture benstr  路  3Comments

magicly picture magicly  路  3Comments

Oppenheimer1 picture Oppenheimer1  路  3Comments