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-drupal] Images URI / URL handling changes in JSON API 2.x #9834

Closed
dcorb opened this issue Nov 9, 2018 · 4 comments
Closed
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@dcorb
Copy link
Contributor

dcorb commented Nov 9, 2018

Description

With Gatsby 2.x and latest Drupal module JSON API 2.x version, it's not indexing correctly the file entities. And it's not possible anymore to take advantage of gatsby-transformer-sharp images query

JSON API 1.x on Drupal <8.5.x
data.attributes.url
JSON API 1.x on Drupal 8.5.x
data.attributes.url
OR
data.attributes.uri.url
JSON API 2.x on Drupal >=8.5.x
data.attributes.uri.url

From https://www.drupal.org/node/2982209

Steps to reproduce

Have a Drupal site with JSON API 2.x and a content type with image fields.
Configure gatsby-source-drupal, and install the "sharp" related plugins.
Run gatsby develop and inspect the schema, (try to query images). You won't see 'localFile'

Expected result

My expectation is to use the same style of image query like the drupal example, but I didn't see "localFile" field
https://github.com/gatsbyjs/gatsby/blob/master/examples/using-drupal/src/templates/recipe.js

relationships {
        category {
          name
        }
        image {
          relationships {
            imageFile {
              localFile {
                childImageSharp {
                  fluid(maxWidth: 470, maxHeight: 353) {
                    ...GatsbyImageSharpFluid
                  }
                }
              }
            }
          }
        }
      }

Actual result

No localFile field in the query.

Environment

  System:
    OS: macOS 10.14
    CPU: x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Shell: 2.7.1 - /usr/local/bin/fish
  Binaries:
    Node: 10.9.0 - /usr/local/bin/node
    Yarn: 1.9.4 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 70.0.3538.77
    Firefox: 63.0
    Safari: 12.0
  npmPackages:
    gatsby: ^2.0.37 => 2.0.37 
    gatsby-image: ^2.0.19 => 2.0.19 
    gatsby-plugin-favicon: ^3.1.4 => 3.1.4 
    gatsby-plugin-manifest: ^2.0.7 => 2.0.7 
    gatsby-plugin-offline: ^2.0.11 => 2.0.11 
    gatsby-plugin-react-helmet: ^3.0.1 => 3.0.1 
    gatsby-plugin-sharp: ^2.0.11 => 2.0.11 
    gatsby-plugin-styled-components: ^3.0.1 => 3.0.1 
    gatsby-plugin-typography: ^2.2.1 => 2.2.1 
    gatsby-source-drupal: ^3.0.7 => 3.0.7 
    gatsby-source-filesystem: ^2.0.7 => 2.0.7 
    gatsby-transformer-sharp: ^2.1.7 => 2.1.7 
  npmGlobalPackages:
    gatsby-cli: 2.4.4
@dcorb
Copy link
Contributor Author

dcorb commented Nov 9, 2018

This PR fixes the issue of indexing correctly the files
#9835

But still I can't see the localFile field inside the images fields. (Are you supposed to see them also through the GraphiQL interface?)

@kakadiadarpan kakadiadarpan added the type: bug An issue or pull request relating to a bug in Gatsby label Nov 9, 2018
@kakadiadarpan
Copy link
Contributor

@dcorb Thanks for the quick PR! I added a suggestion to your PR, that might fix it up.

pieh pushed a commit that referenced this issue Nov 13, 2018
…URI format (#9835)

Description of the issue
#9834

(If this approach is correct, I could add a test for this case)
jlengstorf pushed a commit to jlengstorf/gatsby that referenced this issue Nov 14, 2018
…URI format (gatsbyjs#9835)

Description of the issue
gatsbyjs#9834

(If this approach is correct, I could add a test for this case)
gpetrioli pushed a commit to gpetrioli/gatsby that referenced this issue Jan 22, 2019
…URI format (gatsbyjs#9835)

Description of the issue
gatsbyjs#9834

(If this approach is correct, I could add a test for this case)
@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Jan 29, 2019
@gatsbot
Copy link

gatsbot bot commented Jan 29, 2019

Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open!

@gatsbot
Copy link

gatsbot bot commented Feb 9, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

Thanks again for being part of the Gatsby community!

@gatsbot gatsbot bot closed this as completed Feb 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants