Giter Site home page Giter Site logo

Comments (8)

njosefbeck avatar njosefbeck commented on June 7, 2024

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:

  1. Do you have downloadFiles: true in the plugin's options in gatsby-config?
  2. 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.

brettdewoody avatar brettdewoody commented on June 7, 2024

Thanks for the speedy response.

  1. Yes, I have downloadFiles: true in gatsby-config, here is my config:
   {
      resolve: 'gatsby-source-stripe',
      options: {
        objects: ['Sku', 'Product'],
        secretKey: [SECRET_KEY],
        downloadFiles: true,
      },
    },
  1. I also tried the query you suggested with the expanded localFiles but it returns the same error

from gatsby-source-stripe.

brettdewoody avatar brettdewoody commented on June 7, 2024

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.

brxck avatar brxck commented on June 7, 2024

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.

brxck avatar brxck commented on June 7, 2024

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.

brettdewoody avatar brettdewoody commented on June 7, 2024

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.

brxck avatar brxck commented on June 7, 2024

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.

brettdewoody avatar brettdewoody commented on June 7, 2024

Ah, I see. Thanks for looking into this, much appreciated.

from gatsby-source-stripe.

Related Issues (20)

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.