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

fix(gatsby-source-drupal): sanity check before accessing field #19867

Merged
merged 1 commit into from
Nov 28, 2019

Conversation

mglaman
Copy link
Contributor

@mglaman mglaman commented Nov 28, 2019

Description

I do not know why, but https://d2.api.demo.centarro.io/jsonapi/action/action returned the following error when trying to build a project w/ gatsby-source-drupal

 ERROR #11321  PLUGIN
"gatsby-source-drupal" threw an error while running the sourceNodes lifecycle:
Cannot read property 'next' of undefined
  TypeError: Cannot read property 'next' of undefined
  - gatsby-node.js:109 getNext
    [gatsbyjs_commerce_demo]/[gatsby-source-drupal]/gatsby-node.js:109:24

when unauthenticated. There is a links object. But it is acting like it is null

@mglaman mglaman requested a review from a team as a code owner November 28, 2019 19:49
@pieh pieh changed the title d.data.links returned null fix(gatsby-source-drupal): sanity check before accessing field Nov 28, 2019
Copy link
Contributor

@pieh pieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this specific problem, but addtional sanity check always make sense. Thanks @mglaman!

@pieh pieh merged commit 8a2aeb3 into master Nov 28, 2019
@pieh pieh deleted the mglaman-patch-1 branch November 28, 2019 22:27
@mglaman
Copy link
Contributor Author

mglaman commented Nov 29, 2019

@pieh rad, thanks. Technically it's there when I view it manually 🤷‍♂️I'll be going through the plugin a lot in the next few weeks and try to run the debugger along with it.

@mglaman
Copy link
Contributor Author

mglaman commented Nov 29, 2019

Okay, so this is actually due to to the JSON:API Schema (https://www.drupal.org/project/jsonapi_schema) module. On /jsonapi the describedby route is taken into consideration

    "describedby": {
      "href": "https://d2.api.demo.centarro.io/jsonapi/schema"
    },

This route doesn't follow the jsonapi spec. I'll open an issue for this specifically

mglaman added a commit that referenced this pull request Nov 29, 2019
The JSON:API Schema module (https://www.drupal.org/project/jsonapi_schema) adds a `describedby` link to resources. This payload doesn't contain a JSON:API document, but information describing the object's schema. It's not a valid source of content.

After debugging, it is the original cause of #19867
pieh pushed a commit that referenced this pull request Dec 2, 2019
The JSON:API Schema module (https://www.drupal.org/project/jsonapi_schema) adds a `describedby` link to resources. This payload doesn't contain a JSON:API document, but information describing the object's schema. It's not a valid source of content.

After debugging, it is the original cause of #19867
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants