Skip to content

gatsby-source-contentful useNameForId is inconsistently applied when creating the graphql schema #28329

@davidhousedev

Description

@davidhousedev

Description

Even when useNameForId is set to false for gatsby-source-contentful's gatsby config, the startup process still applies a regexp validation to the content type name. This prevents using emojis in content type names, even when the content type id is used in the graphql schema.

Steps to reproduce

  1. Create a content type in Contentful
  2. Set useNameForId to false in gatsby-config
  3. Verify that your gatsby dev server can start
  4. Change the name of your Contentful content type to add an emoji
  5. Restart your dev server
  6. Verify that your dev server is not able to start up and that you see the following error in your logs:
  GraphQLError: Names must match /^[_a-zA-Z][_a-zA-Z0-9]*$/ but "YOUR_CONTENT_TYPE_NAME" does not.

Expected result

Gatsby allows me to use emojis in the content type name, so long as the content type id is used to build the graphql schema.

Actual result

I cannot start the dev server when there is an emoji in the content type name, and useNameForId is false.

Environment

  System:
    OS: macOS 10.15.7
    CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 14.12.0 - /usr/local/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 6.14.8 - /usr/local/bin/npm
  Languages:
    Python: 3.8.1 - /Users/davidhouse/.pyenv/shims/python
  Browsers:
    Chrome: 87.0.4280.67
    Firefox: 83.0
    Safari: 14.0
  npmPackages:
    gatsby: ^2.24.15 => 2.24.23 
    gatsby-background-image: ^1.1.1 => 1.1.1 
    gatsby-image: ^2.4.14 => 2.4.14 
    gatsby-plugin-anchor-links: ^1.1.1 => 1.1.1 
    gatsby-plugin-emotion: ^4.3.10 => 4.3.10 
    gatsby-plugin-env-variables: ^2.0.0 => 2.0.0 
    gatsby-plugin-manifest: ^2.4.21 => 2.4.21 
    gatsby-plugin-netlify: ^2.3.11 => 2.3.11 
    gatsby-plugin-react-helmet: ^3.3.10 => 3.3.10 
    gatsby-plugin-root-import: ^2.0.5 => 2.0.5 
    gatsby-plugin-segment-js: ^3.3.0 => 3.3.0 
    gatsby-plugin-sentry: ^1.0.1 => 1.0.1 
    gatsby-plugin-sharp: ^2.6.24 => 2.6.24 
    gatsby-plugin-sitemap: ^2.4.11 => 2.4.11 
    gatsby-plugin-typescript: ^2.4.16 => 2.4.16 
    gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.12 => 1.1.12 
    gatsby-plugin-zendesk-chat: ^1.1.4 => 1.1.4 
    gatsby-source-contentful: ^2.3.55-next.21 => 2.3.55-next.21+11a5a7bee4 
    gatsby-source-filesystem: ^2.3.23 => 2.3.23 
    gatsby-transformer-remark: ^2.8.27 => 2.8.27 
    gatsby-transformer-sharp: ^2.5.12 => 2.5.12 

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: source-contentfulRelated to Gatsby's integration with Contentfultype: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions