gatsbyjs / gatsby

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

createPageDependency is not a function #14637

Closed rgnevashev closed 5 years ago

rgnevashev commented 5 years ago

2019-06-08 07:53:11 red box is my external graphql api

after upgrade gatsbyjs 2.8.2 -> 2.8.6

jjcav84 commented 5 years ago

Hello @rgnevashev could you please provide some more info following the guidelines set forth in the docs here https://www.gatsbyjs.org/contributing/how-to-file-an-issue/

smakosh commented 5 years ago

Having the same issue, to reproduce it:

1- Clone my repository: https://github.com/smakosh/gatsby-portfolio-dev 2- upgrade dependencies and follow the instructions on the repo's readme file

JordanStuckings commented 5 years ago

similar problem here.

using the plugin gatsby-source-graphql to query GraphCMS with graphql.

offending query:

return <StaticQuery
        query={graphql`
            query {
                test {
                    assignments {
                        title
                        description
                    }
                }
            }
        `}
        render={data => {
            if (!data.gcms) {
                console.log(data)
                return <p>Loading…</p>
            }
            return data.gcms.blogs.map(b =>
                <div>
                    <h2>{b.title}</h2>
                    <p>{b.post}</p>                
                </div>           
            )
        }}
    />

Reproducible on the graphql explorer: 2019-06-08 23_01_55-Window

package.json:

{
  "name": "gatsby-personal-website",
  "description": "Gatsby MDX Personal Website",
  "version": "1.0.0",
  "author": "###",
  "dependencies": {
    "@mdx-js/mdx": "^1.0.10",
    "@mdx-js/react": "^1.0.6",
    "gatsby": "^2.3.24",
    "gatsby-image": "^2.0.39",
    "gatsby-mdx": "^0.6.2",
    "gatsby-plugin-manifest": "^2.0.29",
    "gatsby-plugin-offline": "^2.0.25",
    "gatsby-plugin-react-helmet": "^3.0.12",
    "gatsby-plugin-sharp": "^2.0.35",
    "gatsby-source-filesystem": "^2.0.29",
    "gatsby-transformer-sharp": "^2.1.18",
    "gatsby-source-graphql": "^2.0.1",
    "prop-types": "^15.7.2",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-helmet": "^5.2.0"
  },
  "keywords": [
    "gatsby"
  ],
  "license": "MIT",
  "scripts": {
    "build": "gatsby build --prefix-paths",
    "develop": "gatsby develop --host 0.0.0.0",
    "start": "npm run develop",
    "format": "prettier --write \"src/**/*.js\"",
    "test": "echo \"Error: no test specified\" && exit 1",
    "deploy": "yarn build && rm -rf ./docs && mv ./public ./docs && git add . && git commit -m \"publish\" && git push"
  },
  "devDependencies": {
    "prettier": "^1.17.0"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/###"
  }
}

gatsby-config.js:

const path = require('path')

module.exports = {
    pathPrefix: '/###',
    siteMetadata: {
    title: '###',
    description:
      'See my latest articles, stories and showreels',
    author: 'Jordan',
  },
  plugins: [
    {
      resolve: `gatsby-mdx`,
      options: {
        defaultLayouts: { default: path.resolve('./src/components/layout.js') },
      },
    },
    'gatsby-plugin-react-helmet',
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `pages`,
        path: `${__dirname}/src/pages`
      }
    },
    'gatsby-transformer-sharp',
    'gatsby-plugin-sharp',
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: '####',
        short_name: '###',
        start_url: '/###',
        background_color: '#5abcbd',
        theme_color: '#5abcbd',
        display: 'minimal-ui',
        icon: 'src/images/###', // This path is relative to the root of the site.
      },
    },
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.app/offline
    // 'gatsby-plugin-offline',
    {
        resolve: "gatsby-source-graphql",
        options: {
            // The top level query type, can be anything you want!
            typeName: "GCMS",
            // The field you'll query against, can also be anything you want.
            fieldName: "gcms",
            // Your API endpoint, available from the dashboard and settings window.
            url: "https://api-apeast.graphcms.com/v1/[KEY]/master",
        },
    },
  ],
}
smakosh commented 5 years ago

Downgrading is a work around.

smerth commented 5 years ago

Can I ask which version you downgraded to?

vektah commented 5 years ago

gatsby 2.8.5 + gatsby-source-graphql 2.0.18 is working

gatsby 2.8.6 + gatsby-source-graphql 2.0.18 is broken

fivetwelve commented 5 years ago

@vektah I removed node_modules, Gatsby (and yarn) caches and regenerated my imports but your combination didn't work me; I still see the same error as OP.

smakosh commented 5 years ago

@smerth

gatsby => 2.5
gatsby-source-graphql => 2.0.10
stefanprobst commented 5 years ago

Hi, could someone confirm that #14665 fixes the issue for you? Thanks!!

jlengstorf commented 5 years ago

@stefanprobst just confirmed the fix in #14665 working. Thanks!

fivetwelve commented 5 years ago

This was a showstopper, so thank you very much for the quick resolution @stefanprobst! Thanks to OP for filing this.