relate-app / gatsby-source-strapi-graphql

A Gatsby source plugin for building websites using Strapi as a data source
BSD Zero Clause License
32 stars 9 forks source link

Random results from the same imageField keep missing #36

Open zuzy-dev opened 1 year ago

zuzy-dev commented 1 year ago

First and foremost. Thanks for your work!

But unfortunately, I ran into an odd issue while querying images.

When I query in the Strapi-GraphQL-Playgound the desired images show up and are fully accessible. No Problem here.

But when I queried Gatsby a few days ago some files were suddenly "null".

There does not seem to be a pattern behind this behavior. I tried deleting the files in Strapi and reuploading them, even tried creating whole new entries. Also clearing my Gatsby cache and restarting with different plugin configurations did not help. I tried different versions of your source plugin and Gatsby and also updated all dependencies accordingly. I even checked for strange filenames, etc... But the images keep missing once they are gone. I find this odd, as they are all fed from the same field and are visible on the Strapi API side. So there should be no difference between them on the Gatsby side, too? They even have the same dimensions and were created from within the same program via the same export settings...

I would be thankful if you could maybe point me in the right direction.

I'm using Strapi v4.5.5 Node v16.14.2

Gatsby v5.3.3 Node v18.12.1 gatsby-source-strapi-graphql ^4.5.0

These are the Strapi Results:

{
  "data": {
    "projects": {
      "data": [
        {
          "attributes": {
            "Project_Startimage": {
              "data": {
                "attributes": {
                  "hash": "start_a26014a9e1"
                }
              }
            }
          }
        },
        {
          "attributes": {
            "Project_Startimage": {
              "data": {
                "attributes": {
                  "hash": "start_e60b4d9cee"   // <-- works in strapi
                }
              }
            }
          }
        },
        {
          "attributes": {
            "Project_Startimage": {
              "data": {
                "attributes": {
                  "hash": "start_65f4f6baf9"   // <-- works in strapi
                }
              }
            }
          }
        }
      ]
    }
  }
}

These are the Gatsby Results:

{
  "data": {
    "allStrapiProjectListing": {
      "edges": [
        {
          "node": {
            "Projects": [
              {
                "project": {
                  "Project_Startimage": {
                    "hash": "start_a26014a9e1"
                  }
                }
              },
              {
                "project": {
                  "Project_Startimage": null   // <-- missing in Gatsby
                }
              },
              {
                "project": {
                  "Project_Startimage": null   // <-- missing in Gatsby
                }
              }
            ]
          }
        }
      ]
    }
  }
}
timbrandin commented 1 year ago

I've seen similar issues when the .cache and public, always solved it by clearing cache, though that might not be a long term solution