Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gatsby crashes every time I update existing .md files #19608

Closed
louishugens opened this issue Nov 19, 2019 · 11 comments
Closed

Gatsby crashes every time I update existing .md files #19608

louishugens opened this issue Nov 19, 2019 · 11 comments
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@louishugens
Copy link

louishugens commented Nov 19, 2019

Description

I have a blog with gatsby and every time i update an existing blog posts .md file, the gatsby develop command crashes with the following error:
Field "featuredImage" must not have a selection since type "String" has no subfields.

Steps to reproduce

install gatsby default starter

gatsby-node.js content:

const path = require(`path`)

exports.createPages = async ({ actions, graphql, reporter }) => {
  const { createPage } = actions

  const blogPostTemplate = path.resolve(`src/templates/blogPost.js`)

  const result = await graphql(`
    {
      allMarkdownRemark(limit: 1000) {
        edges {
          node {
            fields {
              slug
            }
          }
        }
      }
    }
  `)

  // Handle errors
  if (result.errors) {
    reporter.panicOnBuild(`Error while running GraphQL query.`)
    return
  }

  result.data.allMarkdownRemark.edges.forEach(({ node }) => {
    createPage({
      path: node.fields.slug,
      component: blogPostTemplate,
      context: {}, // additional data can be passed via context
    })
  })
}


const { createFilePath } = require('gatsby-source-filesystem')
const { fmImagesToRelative } = require('gatsby-remark-relative-images')

exports.onCreateNode = ({ node, actions, getNode }) => {
  const { createNodeField } = actions
  fmImagesToRelative(node) // convert image paths for gatsby images

  if (node.internal.type === `MarkdownRemark`) {
    const value = createFilePath({ node, getNode })
    createNodeField({
      name: `slug`,
      node,
      value,
    })
  }
}

gatsby-config.js content:

plugins: [
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/static/images`,
        name: 'images',
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        path: `${__dirname}/src/blog-posts`,
        name: 'blog-posts',
      },
    },
    `gatsby-plugin-sharp`,    
    `gatsby-transformer-sharp`,
    {
      resolve: 'gatsby-transformer-remark',
      options: {
        plugins: [
          {
            resolve: 'gatsby-remark-relative-images',
            options: {
              name: 'images',
            },
          },
          {
            resolve: 'gatsby-remark-images',
            options: {},
          },
          // {
          //   resolve: 'gatsby-remark-copy-linked-files',
          //   options: {
          //     destinationDir: 'static',
          //   },
          // },
        ],
      },
    },

Expected result

It work properly until I edit posts.

Actual result

it fails with :

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

Environment

System:
OS: Windows 10
CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
Binaries:
Node: 10.15.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.9.0-next.0 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 3.6.5 - /c/Users/Hugens/AppData/Local/Programs/Python/Python36-32/python
Browsers:
Edge: 44.18362.449.0
npmPackages:
gatsby: ^2.17.6 => 2.17.15
gatsby-background-image: ^0.8.18 => 0.8.19
gatsby-image: ^2.2.30 => 2.2.33
gatsby-plugin-manifest: ^2.2.25 => 2.2.28
gatsby-plugin-netlify-cms: ^4.1.26 => 4.1.28
gatsby-plugin-offline: ^3.0.17 => 3.0.21
gatsby-plugin-react-helmet: ^3.1.13 => 3.1.15
gatsby-plugin-sharp: ^2.2.34 => 2.3.0
gatsby-remark-copy-linked-files: ^2.1.28 => 2.1.30
gatsby-remark-images: ^3.1.29 => 3.1.31
gatsby-remark-relative-images: ^0.2.3 => 0.2.3
gatsby-source-filesystem: ^2.1.35 => 2.1.37
gatsby-transformer-remark: ^2.6.32 => 2.6.35
gatsby-transformer-sharp: ^2.3.1 => 2.3.5

@LekoArts LekoArts added the status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. label Nov 19, 2019
@LekoArts
Copy link
Contributor

Hi!

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Thanks for using Gatsby! 💜

@vladar
Copy link
Contributor

vladar commented Nov 25, 2019

Likely related to gatsby-remark-relative-images. Have you tried this advice from their docs?

Also seems to be related: #19748

@github-actions
Copy link

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Dec 16, 2019
@github-actions
Copy link

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

@tomivirkki
Copy link

This is still an issue with the latest version of Gatsby. It's reproducible with gatsby-source-filesystem and gatsby-transformer-remark alone.

I bumped into this while working with gatsby-transformer-asciidoc to be precise, but it seems to be about the same issue.

My current workaround is to fix Gatsby version to 2.17.16.

Created a repro at https://github.com/tomivirkki/bug-repro

@vladar
Copy link
Contributor

vladar commented Jan 24, 2020

Thanks for the repro. I'll take a look when I have a chance!

@vladar vladar reopened this Jan 24, 2020
@vladar vladar added type: bug An issue or pull request relating to a bug in Gatsby and removed stale? Issue that may be closed soon due to the original author not responding any more. status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. labels Jan 24, 2020
@github-actions
Copy link

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Feb 14, 2020
@github-actions
Copy link

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.
Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 💪💜

@vladar vladar added not stale and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Mar 2, 2020
@vladar vladar reopened this Mar 2, 2020
@vladar
Copy link
Contributor

vladar commented Mar 2, 2020

Looks like we have some sort of race condition which causes hot-page-reloader to start rebuilding pages prematurely (internal event API_RUNNING_QUEUE_EMPTY is called prematurely somehow).

This required further investigation.

@vladar
Copy link
Contributor

vladar commented Mar 2, 2020

Oh but if I upgrade all packages to the latest versions - it stops crashing. So I guess this was already fixed somewhere. Probably here: #20836

@vladar vladar closed this as completed Mar 2, 2020
@tomivirkki
Copy link

Great, it seems to work now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

4 participants