I'm using Gatsby with gatsby-prismic-source-graphql and automatically generating pages from my custom types with slugs built as /article/${uid}.
I'm getting an error in my query on the /article/ route:
Variable "$uid" of required type "String!" was not provided.
Obviously I don't expect the /article/ route to match any uid of my custom types. Is the expected behaviour to redirect to /
?
My query in article.js
looks like this:
export const query = graphql`
query PageQuery($uid: String!) {
prismic {
grid_image(uid: $uid, lang: "en-gb") {
main_text
title
image
}
}
}
`
and my pages config in gatsby-config.js
:
pages: [{
type: 'Grid_image',
match: '/article/:uid',
path: '/article',
component: require.resolve('./src/pages/article.js'),
}],
Routes that do have uid's are working as expected with the correct data coming through e.g. at /articles/foo
Any ideas?