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-source-filesystem] pluging breaks building schema step #20718

Closed
jepek opened this issue Jan 20, 2020 · 15 comments
Closed

[gatsby-source-filesystem] pluging breaks building schema step #20718

jepek opened this issue Jan 20, 2020 · 15 comments
Labels
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.

Comments

@jepek
Copy link

jepek commented Jan 20, 2020

Description

After adding gatsby-source-filesystem:

{
  resolve: `gatsby-source-filesystem`,
  options: {
    name: `images`,
    path: `${__dirname}/src/images/`,
  },
},

to the gatsby-config.js Gatsby develop & build break. Error:

  Error: File.publicURL provided incorrect OutputType: 'String'

image

Steps to reproduce

I can't reproduce it on a clean repository. It happens only in a workspace which is a part of a bigger monorepo. I would like to debug what causes the problem.

Expected result

Adding gatsby-source-filesystem shouldn't break building schema step

Actual result

building schema step ends with an error:

success open and validate gatsby-configs - 0.035s
success load plugins - 0.528s
success onPreInit - 0.004s
info One or more of your plugins have changed since the last time you ran Gatsby. As
a precaution, we're deleting your site's cache to ensure there's no stale data.
success initialize cache - 0.027s
success copy gatsby files - 0.163s
success onPreBootstrap - 0.079s
success createSchemaCustomization - 0.003s
success source and transform nodes - 0.101s
⠋ building schema

 ERROR

UNHANDLED REJECTION File.publicURL provided incorrect OutputType: 'String'



  Error: File.publicURL provided incorrect OutputType: 'String'

  - TypeMapper.js:294 TypeMapper.convertOutputFieldConfig
    [website]/[graphql-compose]/lib/TypeMapper.js:294:15

  - configAsThunk.js:19 resolveOutputConfigAsThunk
    [website]/[graphql-compose]/lib/utils/configAsThunk.js:19:41

  - ObjectTypeComposer.js:300 ObjectTypeComposer.getFieldConfig
    [website]/[graphql-compose]/lib/ObjectTypeComposer.js:300:58

  - toInputObjectType.js:44
    [website]/[graphql-compose]/lib/utils/toInputObjectType.js:44:19

  - Array.forEach

  - toInputObjectType.js:38 toInputObjectType
    [website]/[graphql-compose]/lib/utils/toInputObjectType.js:38:14

  - ObjectTypeComposer.js:600 ObjectTypeComposer.getInputTypeComposer
    [website]/[graphql-compose]/lib/ObjectTypeComposer.js:600:84

  - sort.js:54 getSortInput
    [website]/[gatsby]/dist/schema/types/sort.js:54:42

  - schema.js:1104 addTypeToRootQuery
    [website]/[gatsby]/dist/schema/schema.js:1104:23

  - schema.js:270 processTypeComposer
    [website]/[gatsby]/dist/schema/schema.js:270:13

  - async Promise.all

  - schema.js:211 async updateSchemaComposer
    [website]/[gatsby]/dist/schema/schema.js:211:3

  - schema.js:95 async buildSchema
    [website]/[gatsby]/dist/schema/schema.js:95:3

  - index.js:136 async Object.build
    [website]/[gatsby]/dist/schema/index.js:136:18

  - index.js:415 async module.exports
    [website]/[gatsby]/dist/bootstrap/index.js:415:3

  - develop.js:407 async module.exports
    [website]/[gatsby]/dist/commands/develop.js:407:7

⠋ building schema

Environment

Languages:
Python: 2.7.17 - /usr/local/bin/python
Browsers:
Chrome: 79.0.3945.117
Safari: 13.0.4
npmPackages:
gatsby: ^2.18.12 => 2.18.17
npmGlobalPackages:
gatsby: 2.18.17

gatsby-config.js

/**
 * Configure your Gatsby site with this file.
 *
 * See: https://www.gatsbyjs.org/docs/gatsby-config/
 */

module.exports = {
  /* Your site config here */
  plugins: [
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images/`,
      },
    },
    'gatsby-plugin-typescript',
    'gatsby-plugin-typescript-checker',
    {
      resolve: 'gatsby-plugin-eslint',
      options: {
        test: /\.js$|\.jsx$|\.ts$|\.tsx$/,
        exclude: /(node_modules|.cache|public)/,
        stages: ['develop'],
        options: {
          emitWarning: true,
          failOnError: false,
        },
      },
    },
    {
      resolve: 'gatsby-plugin-react-svg',
      options: {
        rule: {
          include: /assets\/.*\.svg/,
        },
      },
    },
    {
      resolve: `gatsby-plugin-intl`,
      options: {
        // language JSON resource path
        path: `${__dirname}/src/intl`,
        // supported language
        languages: [`en`, `de`],
        // language file path
        defaultLanguage: `en`,
        // option to redirect to `/en` when connecting `/`
        redirect: false,
      },
    },
  ],
}

gatsby-node.js

// eslint-disable-next-line @typescript-eslint/no-var-requires
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin')

exports.onCreateWebpackConfig = ({ actions }) => {
  actions.setWebpackConfig({
    resolve: {
      plugins: [new TsconfigPathsPlugin()],
    },
  })
}

gatsby-browser.js

import './src/styles'
@vladar
Copy link
Contributor

vladar commented Jan 22, 2020

My best guess would be that you have two versions of the graphql package in your repo somehow. But I may be wrong.

I am happy to help to debug this but it is rather hard without at least some reproduction.

@vladar vladar added the status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. label Jan 22, 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 12, 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! 💪💜

@RichardStark
Copy link

you can remove the node_modules dir, and re run npm install/ yarn install. and the problem will be solved

@tomwanderer
Copy link

Have you installed?: npm install --save gatsby-source-filesystem

I've just recently encountered this issue and it turned out that I forgot to install the plugin first.

@jepek
Copy link
Author

jepek commented May 11, 2020

@RichardStark tried multiple times, did not help
@tomwanderer yes, gatsby-source-filesystem is installed in a project

@orifmilod
Copy link

@jepek Have you fixed this issue? I am facing the same problem at the moment.

@jepek
Copy link
Author

jepek commented May 24, 2020

@orifmilod Only by a workaround - keeping the project out of workspaces. Do you use yarn workspaces as well?

@saadnoor
Copy link

I am also facing the same issue. No luck with the above solutions.

@orifmilod
Copy link

@jepek No, I use npm. I had problems with conflicts with AWS-appsync. which was then fixed by just uninstalling the package and reinstalling it, maybe there was a bug in the older version, not sure tho.

@zhangaoyun
Copy link

zhangaoyun commented Jun 11, 2020

I delete the node_modules directory of this project, and run npm install.
It works for me.

@Mrazator
Copy link

Mrazator commented Jun 23, 2020

I have the same problem. My setup is: yarn link gatsby-theme-xyz, yarn install and gatsby build then fails with this error. Could this be connected to the yarn link? Problem with themes?

EDIT: I just published my theme to npm and the problem disappeared. It has to be something with the yarn link or workspaces...

@Stvad
Copy link

Stvad commented Jan 1, 2021

Did anyone figure this out? I'm getting this when I try to use the theme locally with require.resolve(...) no workspaces involved =\

@lorensr
Copy link
Contributor

lorensr commented Feb 27, 2021

This was fixed for me by updating to latest gatsby-source-filesystem@2.11.1

@flogy
Copy link
Contributor

flogy commented Apr 20, 2023

I have the same problem. My setup is: yarn link gatsby-theme-xyz, yarn install and gatsby build then fails with this error. Could this be connected to the yarn link? Problem with themes?

EDIT: I just published my theme to npm and the problem disappeared. It has to be something with the yarn link or workspaces...

Was able to solve it using https://github.com/hugomrdias/connect-deps/ instead of npm link as suggested by @lorensr in #29774 (comment) 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

No branches or pull requests