Open jasloe opened 1 year ago
Just replicated this issue on a clean Gatsby codebase, a new Contentful space, and a new Cloudinary environment.
Confirming that this works as expected:
query MyQuery {
allCloudinaryMedia {
nodes {
gatsbyImageData
}
}
}
But this doesn't:
query MyQuery {
contentfulArtwork {
images {
gatsbyImageData
}
}
}
returns...
{
"data": {
"contentfulArtwork": {
"images": [
{
"gatsbyImageData": null
}
]
}
},
"extensions": {}
}
My environment:
System:
OS: macOS 12.6.3
CPU: (12) x64 Intel(R) Xeon(R) CPU E5-1650 v2 @ 3.50GHz
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.15.0/bin/yarn
npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
Browsers:
Firefox: 89.0.2
npmPackages:
gatsby: ^5.11.0 => 5.11.0
gatsby-plugin-image: ^3.11.0 => 3.11.0
gatsby-plugin-sharp: ^5.11.0 => 5.11.0
gatsby-source-cloudinary: ^0.5.1 => 0.5.1
gatsby-source-contentful: ^8.11.0 => 8.11.0
gatsby-transformer-cloudinary: ^4.4.0 => 4.4.0
gatsby-transformer-sharp: ^5.11.0 => 5.11.0
npmGlobalPackages:
gatsby-cli: 5.7.0
I'll ask my senior dev to send you an email. I'm sure she would like us to have a chat with you about this problem. It is relevant to our work. 😺 👍
The shape of contentfulArtworkCloudinaryImageJsonNode does not match the shape that the transformer plugin expects, but you may connect the sourced CloudinaryMedia
to your contentfulArtworkCloudinaryImageJsonNode
nodes.
exports.createSchemaCustomization = async ({ actions }) => {
actions.createTypes(`
type contentfulArtworkCloudinaryImageJsonNode implements Node {
cloudinaryMedia: CloudinaryMedia @link(by: "publicId", from: "public_id")
}
`);
};
Then you'd need to add one level to get the gatsbyImageData query, doing
cloudinaryMedia {
gatsbyImageData(width: 200)
}
Thank you @AminPainter !
I would be forever grateful if you tested the newest beta jasloe. It adds support by letting you configure the mapping of data.
yarn add gatsby-transformer-cloudinary@4.6.0-beta.1
Take a look at the documentation and let me know how it goes so I may improve if needed.
@jasloe have you been able to test the 4.6.0-beta.1? Looking to make this a current version, but would love an external test before I do.
I am trying to use this project to transform Cloudinary-hosted images passed through Contentful with unfortunately mixed results.
In short, I have a Contentful environment with a content type ("Artwork"). The content type includes a JSON Object field ("cloudinaryImage") connected to the Contentful Cloudinary app. The app is configured correctly and returning data.
gatsby-config.js
contains:template/artwork.js
contains (simplified for brevity):Looking at the console output,
gatsbyImageData
returnsnull
......and throws an error:
Looking at the stack trace, the error happens here:
Not sure where to go with this. I'm able to query and render CloudinaryMedia to the browser without any problem.
gatsby-plugin-image
is working fine with both Contentful-hosted and locally hosted images.