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-contentful useNameForId is inconsistently applied when creating the graphql schema #28329

Closed
davidhousedev opened this issue Nov 27, 2020 · 6 comments · Fixed by #28649
Labels
topic: source-contentful Related to Gatsby's integration with Contentful type: bug An issue or pull request relating to a bug in Gatsby

Comments

@davidhousedev
Copy link

davidhousedev commented Nov 27, 2020

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 
@davidhousedev davidhousedev added the type: bug An issue or pull request relating to a bug in Gatsby label Nov 27, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 27, 2020
@davidhousedev
Copy link
Author

Ah, looks like this was made configurable with useNameForId. My mistake!

@LekoArts LekoArts removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 28, 2020
@davidhousedev davidhousedev changed the title Use Contentful content type id instead of content type name gatsby-source-contentful useNameForId is inconsistently applied when creating the graphql schema Dec 15, 2020
@davidhousedev
Copy link
Author

I'm re-opening this issue because useNameForId only solved half of my original issues with the content type names and the graphql schema. Please see my updated issue title and description. Thanks!

@davidhousedev davidhousedev reopened this Dec 15, 2020
@davidhousedev
Copy link
Author

@LekoArts re-tagging you in case you need to manually re-add the triage needed label.

@kaneshin
Copy link
Contributor

I got the same problem so I've fixed it on the PR #28649 . Thx.

@github-actions
Copy link

github-actions bot commented Jan 5, 2021

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 60 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.
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 Jan 5, 2021
@kaneshin
Copy link
Contributor

ack

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-contentful Related to Gatsby's integration with Contentful type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants