gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.2k stars 10.33k forks source link

[gatsby-source-contentful] Unknown argument "tracedSVGOptions" on field "ContentfulAsset.gatsbyImageData". #31557

Closed prichey closed 3 years ago

prichey commented 3 years ago

Description

I'd like to pass in a configuration object for tracedSVGOptions (per Gatsby reference, example) but I get the following GraphQL error: Unknown argument "tracedSVGOptions" on field "ContentfulAsset.gatsbyImageData"..

Steps to reproduce

In the query:

exampleQuery {
  image {
    gatsbyImageData(
      placeholder: TRACED_SVG
      tracedSVGOptions: { background: "#ffffff", color: "#663399" }
    )
  }
}

Yields the error: Unknown argument "tracedSVGOptions" on field "ContentfulAsset.gatsbyImageData".

Expected result

The query should not throw, and a traced SVG with the given background / color should be rendered.

Actual result

The above error is thrown.

Environment

 System:
    OS: macOS 11.1
    CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.4 - /var/folders/gb/n4714k6158z5svmlr6y_yrfh0000gn/T/fnm_multishell_5036
2_1621521683727/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.10 - /var/folders/gb/n4714k6158z5svmlr6y_yrfh0000gn/T/fnm_multishell_50362
_1621521683727/bin/npm
  Languages:
    Python: 2.7.17 - /usr/local/bin/python
  npmPackages:
    gatsby: ^3.5.0 => 3.5.0
    gatsby-awesome-pagination: ^0.3.8 => 0.3.8
    gatsby-core-utils: ^2.5.0 => 2.5.0
    gatsby-plugin-algolia: ^0.20.0 => 0.20.0
    gatsby-plugin-force-trailing-slashes: ^1.0.5 => 1.0.5
    gatsby-plugin-google-tagmanager: ^3.5.0 => 3.5.0
    gatsby-plugin-image: ^1.5.0 => 1.5.0
    gatsby-plugin-less: ^5.5.0 => 5.5.0
    gatsby-plugin-manifest: ^3.5.0 => 3.5.0
    gatsby-plugin-mdx: ^2.5.0 => 2.5.0
    gatsby-plugin-meta-redirect: ^1.1.1 => 1.1.1
    gatsby-plugin-netlify: ^3.5.0 => 3.5.0
    gatsby-plugin-offline: ^4.5.0 => 4.5.0
    gatsby-plugin-react-helmet: ^4.5.0 => 4.5.0
    gatsby-plugin-react-svg: ^3.0.1 => 3.0.1
    gatsby-plugin-robots-txt: ^1.6.2 => 1.6.2
    gatsby-plugin-root-import: ^2.0.6 => 2.0.6
    gatsby-plugin-sharp: ^3.5.0 => 3.5.0
    gatsby-plugin-sitemap: ^4.1.0 => 4.1.0
    gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.21 => 1.1.22
    gatsby-remark-copy-linked-files: ^4.2.0 => 4.2.0
    gatsby-source-contentful: ^5.5.0 => 5.5.0
    gatsby-source-filesystem: ^3.5.0 => 3.5.0
    gatsby-source-git: ^1.1.0 => 1.1.0
    gatsby-source-github-api: ^1.0.0 => 1.0.0
    gatsby-transformer-sharp: ^3.5.0 => 3.5.0
  npmGlobalPackages:
    gatsby: 3.5.1
prichey commented 3 years ago

Looking into this a bit more, it seems like ContentfulAsset.gatsbyImageData should conform to ImageSharp.gatsbyImageData (type extension here). Is there any reason why this isn't possible? I understand not all ContentfulAssets are images, so maybe it makes sense to expose the underlying childImageSharp? I'm curious to hear what the thinking is here, or if there's a workaround here I'm unaware of. Thanks!

prichey commented 3 years ago

After looking into this even more, it looks like I need to set downloadLocal: true to be able to get at the underlying localFile in order to enable full Sharp transformations. If that's the case, this might just be a documentation problem since I don't see any reference to the fact that you're currently limited in the sharp transformations in the gatsbyImageData query without the downloadLocal route. I'm curious to hear others' thoughts though!

github-actions[bot] commented 3 years ago

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! πŸ’ͺπŸ’œ

prichey commented 3 years ago

This is not stale! Maybe if maintainers don't have the bandwidth to look into issues we should extend the timeout for the stalebot?

github-actions[bot] commented 3 years ago

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! πŸ’ͺπŸ’œ

prichey commented 3 years ago

Yeah, I give up

lukethacoder commented 1 year ago

Ran into a similar issue today with hygraph (GraphCMS). I thinking I'll build my own getImage method to fit my needs instead of relying on the one provided.