Comments (8)
Hi @brettdewoody! Thanks for making this issue. As far as I know, Product images are supported by our download images feature. @brxck would be able to confirm, and be able to help you further debug.
In the interim, a couple of follow-up questions:
- Do you have
downloadFiles: true
in the plugin's options in gatsby-config? - When you query local files, the query would be something like
query allProducts {
products: allStripeProduct {
edges {
node {
id
images
localFiles {
id
}
}
}
}
}
Note the way I'm expanding the localFiles field. Does this also not work for you?
Answering these questions will help us debug. Also, as an aside, you opened another issue in this repo that I responded to awhile back. Is that issue resolved? If you could go over there and let us know, that'd be great. Thanks!
from gatsby-source-stripe.
Thanks for the speedy response.
- Yes, I have
downloadFiles: true
ingatsby-config
, here is my config:
{
resolve: 'gatsby-source-stripe',
options: {
objects: ['Sku', 'Product'],
secretKey: [SECRET_KEY],
downloadFiles: true,
},
},
- I also tried the query you suggested with the expanded
localFiles
but it returns the same error
from gatsby-source-stripe.
This could be related, I've noticed when I start gatsby
, using npm start
, the following error occurs:
Error: Invariant Violation: Encountered an error trying to infer a GraphQL type for: "product.localFiles___NODE". There is no corresponding node with the id field mat ching: "067fd1df-5418-556b-b255-964867adcf80,067fd1df-5418-556b-b255-964867adcf80,067fd1df-5418-556b-b255-964867adcf80,067fd1df-5418-556b-b255-964867adcf80"
To resolve this I rm -rf .cache
, then npm start
succeeds.
from gatsby-source-stripe.
Edit: Ignore this, I see the real issue here. One second!
I'm using Checkout Beta
I haven't been able to test with Checkout Beta yet, so this throws a red flag for me. I don't know under which circumstances downloading happens to work with Checkout Beta, so I wouldn't rely on it.
That last error is indicative of the file download failing, unfortunately the API we rely on doesn't surface those errors. I'm fairly certain this is a Checkout thing — not yet supported, but I will look into it!
from gatsby-source-stripe.
Actually, I'm pretty sure this is the real issue:
These images are hosted elsewhere, in my case they live in the static directory of my Gatsby site.
The Gatsby build lifecycle doesn't work in your favor here. Node creation happens before anything is hosted on the development server. So we are failing on download because a URL like http://localhost:8000/products/600.jpg
doesn't resolve to an image yet. This be a problem in production as well.
I don't think there's yet a clear way to co-host the images, which need to be downloaded on build, your Gatsby site. I imagine we could support this in the future by adding another flag to search for images in the source?
In the meantime you could probably add this sort of functionality to your own site by hooking into onCreateNode in gatsby-node.js. Otherwise it would probably be easiest to host the images separately from the site. A free host is sufficient because they will only ever be accessed by Gatsby on build.
from gatsby-source-stripe.
Ok, I see what you're saying. So if the images are moved to an external host it should work.
However, in GraphiQL, how will moving the images to an external source prevent the error of:
Cannot query field "localFiles" on type "StripeProduct".
from gatsby-source-stripe.
Yep that's right!
That GraphQL error is an artifact of the same problem. No images were downloaded, Gatsby never had anything to put into the localFiles field, so it strips the field from the StripeProduct node type. It shouldn't be an issue if you get image downloading working.
from gatsby-source-stripe.
Ah, I see. Thanks for looking into this, much appreciated.
from gatsby-source-stripe.
Related Issues (20)
- Cannot query field "allStripeSku" on type "Query" even with a valid secret key HOT 11
- Products with recurring payment not shown on Gatsby shop HOT 4
- Q1 Updates HOT 1
- Is there a way of getting back the price of a subscription (product) HOT 1
- Is there a ay of getting back the price of a subscription (product) HOT 4
- Support for the new Prices API HOT 3
- Price instead of SKU HOT 6
- Pulling product details HOT 3
- Get Price in stripeProduct query HOT 1
- Images not downloaded for Price objects HOT 1
- Cannot query product field on price object HOT 4
- Support for "tiers" on the Prices API HOT 4
- Gatsby 3 touchNode deprecation warning HOT 4
- Using Gatsby Image with Gatsby Source Stripe HOT 8
- [HELP WANTED] - GatsbyV4 [bug] - error while running the sourceNodes lifecycle HOT 2
- Error "Cannot query field \"product\" on type \"StripePrice\"." HOT 3
- Upgrade backend implementation to use ES modules
- Enable GraphQL support for Product images HOT 4
- Product object not showing in the graphQL HOT 3
- Out of date Stripe SDK API version HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-source-stripe.