Open YusukeSano opened 1 year ago
Before you submit:
Question I have added a field for image URL using Gatsby createResolvers API.
// gatsby-node.js exports.createResolvers = ({ createResolvers }) => { createResolvers({ Post: { imageUrl: { type: 'String!', resolve(source) { const getImageUrl = (text) => { // The process of extracting the image URL from text } return getImageUrl(source.text) }, }, }, }) }
I can retrieve the value of the field using the following query:
export const query = graphql` { allPost { nodes { text # Text containing the image URL imageUrl # https://... } } } `
I have configured the field, but when I execute the query, an error occurs.
// gatsby-config.js module.exports = { //... plugins: [ //... other plugins { resolve: `@imgix/gatsby`, options: { defaultImgixParams: { auto: ['compress', 'format'] }, fields: [ { nodeType: 'Post', fieldName: 'imgixImage', rawURLKey: 'imageUrl', }, ], }, }, ], };
Error:
Error when resolving URL value for node type Post. This probably means that the rawURLKey function in gatsby-config.js is incorrectly set. Please read this project's README for detailed instructions on how to set this correctly.
Is it possible to use customized GraphQL fields?
Before you submit:
Question I have added a field for image URL using Gatsby createResolvers API.
I can retrieve the value of the field using the following query:
I have configured the field, but when I execute the query, an error occurs.
Error:
Is it possible to use customized GraphQL fields?