sku.product.localFiles is empty unless sku.image is present
Closed this issue · 2 comments
Prerequisites
- Put an X between the brackets on this line if you have done all of the following:
- Read through the README fully
- Ensured you are running Node v.10 or above
- Made sure you're using at least Gatsby v.2.0.15
- Checked that your issue isn't already filed
Description
Hey! I've been having an issue with gatsby-starter-stripe and I'm finally getting around to figuring it out.
This started happening after upgrading the plugin to 3.0+. sku.product.images
is always empty unless sku.image
is present. I'll provide an example of two skus of the same product:
{
"node": {
"id": "sku_EsZzIlws0rJnTu",
"image": "https://raw.githubusercontent.com/brxck/gatsby-starter-stripe/master/images/osprey_aether_pro1.jpg",
"product": {
"name": "Osprey Aether Pro 70",
"id": "prod_EsZynTea7jNNWv",
"images": [ ... ],
"localFiles": [
// yep they're here
]
}
}
},
{
"node": {
"id": "sku_EsZzHhPj9lU0ck",
"image": null, // this is the only difference
"product": {
"name": "Osprey Aether Pro 70",
"id": "prod_EsZynTea7jNNWv",
"images": [ ... ],
"localFiles": null // but they're not here!
}
}
},
I haven't been able to figure out why this is happening yet.
Steps to Reproduce
Create a product with a product image. Create two skus for the product, one with a sku image (with_image
) and one without (without_image
).
Expected behavior: Both skus should have product images on sku.product.localFiles
.
Actual behavior: Only with_image.product.localFiles
contains file nodes. without_image.product.localFiles
is null.
Reproduces how often: Every time.
Versions
os: Linux
node: v10.11.0
npm: 6.9.0
gatsby: 2.5.12
gatsby-source-stripe: 3.0.2
Looks like this is where this is occurring. hasFilesToDownload will return false if a sku doesn't have an image, regardless of it's product.images field.
I'll try to get around to a PR when I get the time!
As you probably saw, this is up on npm! If you notice any issues, let me know 👍