gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.3k forks source link

The Dreaded Field "image" must not have a selection since type "String" has no subfields. Error #25307

Closed ardalis closed 4 years ago

ardalis commented 4 years ago

Summary

I keep getting this error when I try to build locally. Most of the time, at least, my site builds successfully on Netlify's build servers.

Output from gatsby develop after clean:

success open and validate gatsby-configs - 0.086s
success load plugins - 1.699s
success onPreInit - 0.010s
success initialize cache - 0.007s
success copy gatsby files - 0.076s
success onPreBootstrap - 0.004s
success createSchemaCustomization - 0.026s
success source and transform nodes - 16.944s
success building schema - 0.521s
success createPages - 1.042s
success createPagesStatefully - 0.323s
success onPreExtractQueries - 0.000s
success update schema - 0.041s

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\architecture-ebook-page.js:99:15

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\assessments-page.js:94:15

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\cloud-native-ebook-page.js:99:15

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\index-page.js:165:15

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\interviews-page.js:94:15

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\mentoring-page.js:94:15

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\software-craftsmanship-2016-wall-calendar-sponsorship-page.js:94:15

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\tips-page.js:122:15

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\training-classes-page.js:94:15

 ERROR #85922  GRAPHQL

There was an error in your GraphQL query:

Field "image" must not have a selection since type "String" has no subfields.

This can happen if you e.g. accidentally added { } to the field "image". If you didn't expect "image" to be of type "String" make sure that your input source and/or plugin is correct.

File: src\templates\tools-used-page.js:94:15

failed extract queries from components - 0.569s
success write out requires - 0.077s
success write out redirect data - 0.021s
success onPostBootstrap - 0.012s

Relevant information

My repo is publicly available here: https://github.com/ardalis/ardalis-com-gatsby

The site is online at https://ardalis.com

Environment (if relevant)

System: OS: Windows 10 10.0.18363 CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz Binaries: Node: 14.2.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.4 - ~\AppData\Roaming\npm\yarn.CMD npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD Languages: Python: 3.8.3 Browsers: Edge: 44.18362.449.0 npmPackages: gatsby: ^2.20.35 => 2.21.9 gatsby-dynamic-image: ^0.2.0 => 0.2.0 gatsby-image: ^2.3.5 => 2.4.0 gatsby-plugin-google-tagmanager: ^2.3.4 => 2.3.4 gatsby-plugin-mailchimp: ^5.1.2 => 5.1.2 gatsby-plugin-material-ui: ^2.1.8 => 2.1.8 gatsby-plugin-netlify: ^2.2.4 => 2.3.0 gatsby-plugin-netlify-cms: ^4.2.5 => 4.3.0 gatsby-plugin-paginate: ^1.12.0 => 1.12.0 gatsby-plugin-purgecss: ^5.0.0 => 5.0.0 gatsby-plugin-react-helmet: ^3.2.5 => 3.3.0 gatsby-plugin-robots-txt: ^1.5.1 => 1.5.1 gatsby-plugin-sass: ^2.2.4 => 2.3.0 gatsby-plugin-sharp: ^2.5.7 => 2.6.0 gatsby-plugin-sitemap: ^2.4.5 => 2.4.5 gatsby-plugin-twitter: ^2.3.1 => 2.3.1 gatsby-remark-copy-linked-files: ^2.2.4 => 2.3.1 gatsby-remark-images: ^3.2.6 => 3.3.0 gatsby-remark-normalize-paths: ^1.0.0 => 1.0.0 gatsby-remark-prismjs: ^3.5.2 => 3.5.2 gatsby-remark-relative-images: ^0.3.0 => 0.3.0 gatsby-source-filesystem: ^2.2.5 => 2.3.0 gatsby-transformer-remark: ^2.8.13 => 2.8.13 gatsby-transformer-sharp: ^2.4.7 => 2.5.0 npmGlobalPackages: gatsby-cli: 2.12.49

File contents (if changed)

gatsby-config.js:

require("dotenv").config({
  path: `.env.${process.env.NODE_ENV}`,
})

module.exports = {
  siteMetadata: {
    title: 'Ardalis is Steve Smith - ardalis',
    author:'Steve Smith',
    siteUrl: 'https://ardalis.com',
    description:
      'Steve is an experienced software architect and trainer, focusing currently on ASP.NET Core and Domain-Driven Design.',
    social: {
      twitter: `ardalis`,
    },
    image: '/img/ardalis-icon-128x128.png'
  },
  plugins: [
    {
      resolve: "gatsby-plugin-google-tagmanager",
      options: {
        id: "GTM-NVBMVX8",
        includeInDevelopment: false,
      }
    },
    {
      resolve: 'gatsby-plugin-robots-txt',
      options: {
        host: 'https://www.ardalis.com',
        sitemap: 'https://www.ardalis.com/sitemap.xml',
        policy: [{ userAgent: '*', allow: '/' }]
      }
    },
    'gatsby-plugin-react-helmet',
    `gatsby-plugin-twitter`,
    'gatsby-plugin-sitemap',
    'gatsby-plugin-sass',
    'gatsby-plugin-sharp',
    'gatsby-transformer-sharp',
    {
      // keep as first gatsby-source-filesystem plugin for gatsby image support
      resolve: 'gatsby-source-filesystem',
      options: {
        path: `${__dirname}/static/img`,
        name: 'uploads',
      },
    },
    {
      resolve: 'gatsby-source-filesystem',
      options: {
        path: `${__dirname}/src/pages`,
        name: 'pages',
      },
    },
    {
      resolve: 'gatsby-source-filesystem',
      options: {
        path: `${__dirname}/src/img`,
        name: 'images',
      },
    },

    {
      resolve: 'gatsby-plugin-mailchimp',
      options: {
          endpoint: 'https://ardalis.us13.list-manage.com/subscribe/post?u=ddf5f72371bc4c837a6667f27&id=40af84bfa3', 
      },
    },
    `gatsby-plugin-material-ui`,
    'disqus-react',
    'react-markdown',
    {
      resolve: 'gatsby-transformer-remark',
      options: {
        plugins: [
          {
            resolve: 'gatsby-remark-relative-images',
            options: {
              name: 'uploads',
            },
          },
          {
            resolve: `gatsby-remark-prismjs`,
            options: {
              // Class prefix for <pre> tags containing syntax highlighting;
              // defaults to 'language-' (e.g. <pre class="language-js">).
              // If your site loads Prism into the browser at runtime,
              // (e.g. for use with libraries like react-live),
              // you may use this to prevent Prism from re-processing syntax.
              // This is an uncommon use-case though;
              // If you're unsure, it's best to use the default value.
              classPrefix: "language-",
              // This is used to allow setting a language for inline code
              // (i.e. single backticks) by creating a separator.
              // This separator is a string and will do no white-space
              // stripping.
              // A suggested value for English speakers is the non-ascii
              // character '›'.
              inlineCodeMarker: null,
              // This lets you set up language aliases.  For example,
              // setting this to '{ sh: "bash" }' will let you use
              // the language "sh" which will highlight using the
              // bash highlighter.
              aliases: {},
              // This toggles the display of line numbers globally alongside the code.
              // To use it, add the following line in gatsby-browser.js
              // right after importing the prism color scheme:
              //  require("prismjs/plugins/line-numbers/prism-line-numbers.css")
              // Defaults to false.
              // If you wish to only show line numbers on certain code blocks,
              // leave false and use the {numberLines: true} syntax below
              showLineNumbers: false,
              // If setting this to true, the parser won't handle and highlight inline
              // code used in markdown i.e. single backtick code like `this`.
              noInlineHighlight: false,
              // This adds a new language definition to Prism or extend an already
              // existing language definition. More details on this option can be
              // found under the header "Add new language definition or extend an
              // existing language" below.
              languageExtensions: [
                {
                  language: "aspnet",
                  definition: {
                    superscript_types: /(SuperType)/,
                  },
                  insertBefore: {
                    function: {
                      superscript_keywords: /(superif|superelse)/,
                    },
                  },
                },
              ],
              // Customize the prompt used in shell output
              // Values below are default
              prompt: {
                user: "root",
                host: "localhost",
                global: false,
              },
              // By default the HTML entities <>&'" are escaped.
              // Add additional HTML escapes by providing a mapping
              // of HTML entities and their escape value IE: { '}': '&#123;' }
              escapeEntities: {},
            },
          },
          {
            resolve: 'gatsby-remark-images',
            options: {
              // It's important to specify the maxWidth (in pixels) of
              // the content container as this plugin uses this as the
              // base for generating different widths of each image.
              maxWidth: 2048,
            },
          },
          {
            resolve: 'gatsby-remark-copy-linked-files',
            options: {
              destinationDir: 'static',
            },
          },
        ],
      },
    },
    {
      resolve: 'gatsby-plugin-netlify-cms',
      options: {
        modulePath: `${__dirname}/src/cms/cms.js`,
      },
    },
    {
      resolve: 'gatsby-plugin-purgecss', // purges all unused/unreferenced css rules
      options: {
        develop: true, // Activates purging in npm run develop
        purgeOnly: ['/all.sass'], // applies purging only on the bulma css file
      },
    }, // must be after other CSS plugins
    'gatsby-plugin-netlify', // make sure to keep it last in the array
  ],
}

package.json: N/A gatsby-node.js: N/A gatsby-browser.js: N/A gatsby-ssr.js: N/A

ardalis commented 4 years ago

I did try this but it didn't appear to help at all so I removed it: https://www.gatsbyjs.org/packages/gatsby-remark-normalize-paths/

pieh commented 4 years ago

This is most likely fmImagesToRelative from gatsby-remark-relative-images problem - it's listed in their FAQ (this is community plugin and is not maintained in this repo) - https://www.gatsbyjs.org/packages/gatsby-remark-relative-images/#im-getting-the-error-field-image-must-not-have-a-selection-since-type-string-has-no-subfields

I keep getting this error when I try to build locally. Most of the time, at least, my site builds successfully on Netlify's build servers.

This is most likely because the plugin I mentioned does seem to have caching issue - it works when .cache is not there (so on first run), but fails on next runs (if gatsby doesn't invalidate the .cache) - this can be seen in https://github.com/gatsbyjs/gatsby/issues/25095 as well

pieh commented 4 years ago

I actually do think this is in fact duplicate of #25095 so I'll close this one as duplicate in favour of already open issue