gatsby-source-prismic-graphql icon indicating copy to clipboard operation
gatsby-source-prismic-graphql copied to clipboard

GraphQLError: Syntax Error: Invalid number, expected digit but got: "p".

Open stephane-klein opened this issue 4 years ago • 3 comments

Hi,

How can I enable verbose mode to debug this error?

success building schema - 0.307s

 ERROR #11321  PLUGIN

"gatsby-source-prismic-graphql" threw an error while running the createPages lifecycle:

Syntax Error: Invalid number, expected digit but got: "p".



  GraphQLError: Syntax Error: Invalid number, expected digit but got: "p".

failed createPages - 0.518s

Best regards, Stéphane

stephane-klein avatar Mar 26 '20 21:03 stephane-klein

This is my bug:

  • in gatsby-config.js:
            pages: [{ // (optional, builds pages dynamically)
                type: 'content-page-1', // TypeName from prismic
                match: '/article/:uuid', // Pages will be generated under this pattern
                path: '/article', // Placeholder page for unpublished documents
                component: require.resolve('./src/templates/ArticlePageTemplate.js')
            }]

fixed version:

            pages: [{ // (optional, builds pages dynamically)
                type: 'ContentPage1', // TypeName from prismic
                match: '/article/:uuid', // Pages will be generated under this pattern
                path: '/article', // Placeholder page for unpublished documents
                component: require.resolve('./src/templates/ArticlePageTemplate.js')
            }]

The bug was type: 'content-page-1' instead of type: 'ContentPage1'.

Question: it's is possible to add a type value checking in the code? and display one error message if type value is not found or invalid?

Best regards, Stéphane

stephane-klein avatar Mar 26 '20 22:03 stephane-klein

It might not solve the problem but I notice you are using :uuid, im using :uid wondered if there was any reason you are using it like this?

jodiedoubleday avatar Mar 30 '20 12:03 jodiedoubleday

@jodiedoubleday thanks, yes, it is a mistake 👍. But not the bug of this issue.

stephane-klein avatar Apr 01 '20 21:04 stephane-klein