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

createNodeField is not working in gatsby-remarked plugin #20684

Closed
crutchcorn opened this issue Jan 17, 2020 · 5 comments
Closed

createNodeField is not working in gatsby-remarked plugin #20684

crutchcorn opened this issue Jan 17, 2020 · 5 comments
Labels
status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@crutchcorn
Copy link

Description

Describe the issue that you're seeing.

I'm seeing that whenever I use a gatsby-transformer-remark plugin that has a createFieldNode function call, it does not add said field to the GQL instance

Steps to reproduce

Add in a createNodeField in an example plugin, add said plugin to gatsby-transformer-remark plugins array

Load develop version, query for the field name, see that it's not being grabbed and throwing errors

Example Project I'm Seeing This In

https://github.com/unicorn-utterances/unicorn-utterances/blob/fix-count/plugins/count-inline-code/index.js#L21

And include the plugin locally in the gatsby-config file:

https://github.com/unicorn-utterances/unicorn-utterances/blob/fix-count/gatsby-config.js#L64

Expected result

What should happen?

I want to be able to query for a field I've created in the createNodeField in the GQL instance

Actual result

What happened.

I am not able to query the inlineCount of the node I expect that field to be on with the error:

Cannot query field "inlineCount" on type "MarkdownRemarkFields"

Cannot query field "inlineCount" on type "MarkdownRemarkFields"

Which is strange, because running through the node debugger diving into the gatsby code, it seems that the internal value is being set on the node, as expected:

A chrome debugger showing node's inlineCount being added properly in Gatsby code

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

  System:
    OS: macOS 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Shell: 5.3 - /bin/zsh
  Binaries:
    Node: 10.16.3 - ~/.nvm/versions/node/v10.16.3/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.13.1 - ~/.nvm/versions/node/v10.16.3/bin/npm
  Languages:
    Python: 2.7.17 - /usr/local/bin/python
  Browsers:
    Chrome: 79.0.3945.117
    Firefox: 71.0
    Safari: 13.0.4
  npmPackages:
    gatsby: ^2.15.35 => 2.15.35
    gatsby-image: ^2.2.26 => 2.2.26
    gatsby-plugin-feed: ^2.3.16 => 2.3.16
    gatsby-plugin-google-analytics: ^2.1.21 => 2.1.21
    gatsby-plugin-lunr: ^1.5.2 => 1.5.2
    gatsby-plugin-manifest: ^2.2.21 => 2.2.21
    gatsby-plugin-offline: ^3.0.14 => 3.0.14
    gatsby-plugin-prefetch-google-fonts: ^1.4.3 => 1.4.3
    gatsby-plugin-react-helmet: ^3.1.11 => 3.1.11
    gatsby-plugin-react-svg: ^2.1.2 => 2.1.2
    gatsby-plugin-sass: ^2.1.18 => 2.1.18
    gatsby-plugin-sharp: ^2.2.29 => 2.2.29
    gatsby-plugin-sitemap: ^2.2.17 => 2.2.17
    gatsby-plugin-transition-link: ^1.13.0 => 1.13.0
    gatsby-remark-autolink-headers: ^2.1.14 => 2.1.14
    gatsby-remark-copy-linked-files: ^2.1.26 => 2.1.26
    gatsby-remark-external-links: 0.0.4 => 0.0.4
    gatsby-remark-images: ^3.1.26 => 3.1.26
    gatsby-remark-images-medium-zoom: ^1.4.0 => 1.4.0
    gatsby-remark-prismjs: ^3.3.18 => 3.3.18
    gatsby-remark-responsive-iframe: ^2.2.23 => 2.2.23
    gatsby-remark-video: ^1.2.4 => 1.2.4
    gatsby-source-filesystem: ^2.1.31 => 2.1.31
    gatsby-transformer-json: ^2.2.13 => 2.2.13
    gatsby-transformer-remark: ^2.6.28 => 2.6.28
    gatsby-transformer-sharp: ^2.2.21 => 2.2.21
@sidharthachatterjee sidharthachatterjee added the type: bug An issue or pull request relating to a bug in Gatsby label Jan 23, 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 13, 2020
@crutchcorn
Copy link
Author

This is still a bug and it's still blocking me in various ways. I plan to, in the next week or so, dive in and see if I can fix it

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Feb 13, 2020
@jlkiri
Copy link
Contributor

jlkiri commented Feb 14, 2020

@crutchcorn Hi, I built your project and cannot reproduce the bug... It works for me, i.e. I can query inlineCount of any markdown node by id. Can you specify the details, please?

Screen Shot 2020-02-14 at 15 11 26

@jlkiri jlkiri added the status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. label Feb 14, 2020
@crutchcorn
Copy link
Author

Golly! I must've been running an old version. This seems to've been fixed. Sorry about that, all!

@hassankhan
Copy link
Contributor

hassankhan commented Dec 17, 2020

Hi @jlkiri, I think I'm having the same issue. I've got a Gatsby Remark plugin as per the Gatsby docs, and in the index.js I'm using createNodeField() to add a custom field but it won't show up. I've updated both gatsby and gatsby-transformer-remark, and also ran gatsby clean just to be sure.

Steps to reproduce:

  1. Clone https://github.com/cube-js/cube.js
  2. Check out the hassankhan/docs/gatsby-page-menu-plugin branch
  3. Navigate to docs/ within the repo and run yarn start
  4. Go to localhost:8000/__graphql and use the Explorer to check markdownRemark.fields

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

4 participants