question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
Mrazatorcommented, 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

1reaction
jepekcommented, May 24, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Common Errors - Gatsby
Errors using gatsby-plugin-image and sharp. Gatsby's image processing is broken up into different packages which need to work together to source images and ......
Read more >
Error building schema with gatsby-source-filesystem config ...
I know the issue is when adding gatsby-source-filesystem into the gatsby-config. js file because when I delete it, I can run gatsby develop...
Read more >
gatsby-plugin-mdx - npm
Start using gatsby-plugin-mdx in your project by running `npm i ... npm install gatsby-plugin-mdx gatsby-source-filesystem @mdx-js/react ...
Read more >
gatsby-source-prismic v4 Roadmap - Labs
The next major version of the Prismic source plugin introduces several new features, a dedicated preview plugin, and better developer ergonomics.
Read more >
Build A Custom Static Site With Headless Ghost + Gatsby
Gatsby Source Filesystem is a plugin for creating additional directories inside a Gatsby site. This is ideal for storing static files (e.g. error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found