Skip to content

Gatsby/Wordpress returning null on images after unpublishing #13104

@HandsomeCreative

Description

@HandsomeCreative

Description

I'm using: Gatsby, Wordpress, and gatsby-source-wordpress, and ACF on Wordpress for my custom data.

The issue I'm encountering is this: when a post is unpublished (from being published to a draft), and then re-published, the images (or almost all of them) become null.

Example GraphQL being used:

        main_images {
          product_code
          image {
            title
            localFile {
              childImageSharp {
                fluid(maxWidth: 1200) {
                  ...GatsbyImageSharpFluid_withWebp
                }
                fixed(width: 100) {
                  ...GatsbyImageSharpFixed
                }
              }
            }
          }
        }

In the instance of this GraphQL field, the issue I'm having is that localFile will be null. The title in that query comes back fine, however.

Furthermore, it also seems that the wordpress API response is correct. It seems highly possible its a bug in gatsby-source-wordpress, caching related?

Help or advice would be much appreciated.

Other notes:

  • Unpublishing it and republishing it again (or several times) doesn't fix it
  • The only way I know to fix this issue is to delete all the images on the post and re-add them.
  • The images have return type of Image URL (changing it has no effect on the issue)

Steps to reproduce

Clear steps describing how to reproduce the issue. Please please please link to a demo project if possible, this makes your issue much easier to diagnose (seriously).

Expected result

What should happen?

Actual result

What happened.

Environment

System:
OS: Windows 10
CPU: (16) x64 AMD Ryzen 7 2700 Eight-Core Processor
Binaries:
Yarn: 1.13.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: 42.17134.1.0
npmPackages:
gatsby: ^2.1.0 => 2.2.6
gatsby-image: ^2.0.20 => 2.0.25
gatsby-plugin-manifest: ^2.0.9 => 2.0.12
gatsby-plugin-netlify-cache: ^1.1.0 => 1.1.0
gatsby-plugin-offline: ^2.0.16 => 2.0.20
gatsby-plugin-react-helmet: ^3.0.2 => 3.0.5
gatsby-plugin-react-svg: ^2.0.0 => 2.0.0
gatsby-plugin-sharp: ^2.0.14 => 2.0.16
gatsby-plugin-sitemap: ^2.0.11 => 2.0.11
gatsby-plugin-styled-components: ^3.0.4 => 3.0.4
gatsby-source-filesystem: ^2.0.8 => 2.0.12
gatsby-source-wordpress: ^3.0.25 => 3.0.25
gatsby-transformer-sharp: ^2.1.8 => 2.1.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: confirmedIssue with steps to reproduce the bug that’s been verified by at least one reviewer.type: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions