GithubHelp home page GithubHelp logo

prismicio-community / gatsby-starter-prismic-blog Goto Github PK

View Code? Open in Web Editor NEW
40.0 40.0 24.0 5.32 MB

Blog project with Gatsby & Prismic

Home Page: https://gatsby-starter-prismic-blog.vercel.app

License: Apache License 2.0

JavaScript 99.68% CSS 0.32%

gatsby-starter-prismic-blog's People

Contributors

a-trost avatar angeloashmore avatar dependabot[bot] avatar levimykel avatar pauprismic avatar pvpg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-starter-prismic-blog's Issues

post.js always returns blank (empty array)

I was following this guide and managed to get things running (after some other odd errors):
https://intercom.help/prismicio/en/articles/2933292-sample-blog-with-api-based-cms-gatsby-js

However, when navigating to a blog post after running gatsby develop, it simply shows a blank page. In the Prismic repository, all fields are filled in as expected.

Logging props.data.prismic.allPosts.edges in post.js reveals an empty array. No matter what post is navigated to, it's simply blank.

I feel like there's an issue with the setup/query that fetches the post. It's almost as if the UID is not getting passed correctly?

If I try the query in the GraphiQL playground with the post UID it works but in the template, the exact same query does not return the post.

query BlogPostQuery($uid: String!) {
  prismic {
    allPosts(uid: $uid) {
      edges {
        node {
          _meta {
            id
            uid
            type
          }
          title
          date
          body {
            __typename
            ... on PRISMIC_PostBodyText {
              type
              label
              primary {
                text
              }
            }
            ... on PRISMIC_PostBodyQuote {
              type
              label
              primary {
                quote
              }
            }
            ... on PRISMIC_PostBodyImage_with_caption {
              type
              label
              primary {
                image
                caption
              }
            }
          }
        }
      }
    }
  }
}

See the screenshot:
Screenshot 2019-10-13 at 19 20 21

Any ideas what's going on here? On the home page, the post is listed just fine (so of course it does exist).

There are no errors in the web console nor the terminal.

Thanks.

gatsby build with childImageSharp in query will fail unless gatsby develop is ran first

When querying for the 'sharp' version of an image field gatsby build will fail unless gatsby develop is ran first. This results in not being able to deploy.

I have replicated this issue with a fresh pull of this repo and only making this change to the query on the post.js template to ensure that it wasn't any of my other template changes:

... on PRISMIC_PostBodyImage_with_caption{
    type
    label
    primary{
        image
        imageSharp {
            absolutePath
            childImageSharp {
                fluid(maxWidth: 800) {
                    ...GatsbyImageSharpFluid
                }
            }
        }
        caption
    }
}

Resulting in this error:

Screenshot of error

When trying to debug the changes I have noticed that there are no cached files created for gatsby-source-prismic-graphql on gatsby build. I removed .cache from .gitignore in order to be able to track the cache files created.

If I remove .cache from .gitignore and I follow the process of:

  1. Run Gatsby build - this will fail with the above error and commit cache files
  2. Run Gatsby develop - Will notice that a new redux directory has been created

Screenshot of git changed files

  1. Run Gatsby build - this will now succeed and the gatsby-source-prismic-graphql will also now be created and everything works as intended

Screenshot of git changed files

If I was to repeat this process again and remove the created redux files from the cache directory after step 2 before running gatsby build again then the same initial error is given again so I think this is the route of the issue.

After looking in the code as much as I can I can't seem to find what is creating the redux files in the cache directory but I am not an expert at this.

If there is anything I can do to help with this issue please let me know as I am stuck but hit the wall in terms of what my expertise at this will help me debug. Thanks!

(Update - I have created a repo with the example build and the progressive cache commits incase this helps https://github.com/MatthewShields/issue--prismic-blog-gatsby-build)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.