GithubHelp home page GithubHelp logo

lucasvocos / gatsby-sanity-shopify Goto Github PK

View Code? Open in Web Editor NEW
109.0 109.0 14.0 7.17 MB

Unopinionated bare-bones Gatsby + Sanity + Shopify starter

License: MIT License

JavaScript 99.56% CSS 0.44%
gatsby gatsby-sanity-shopify sanity shopify shopify-products

gatsby-sanity-shopify's Introduction

Hi there. !Hola! ๐Ÿ‘‹

gatsby-sanity-shopify's People

Contributors

lucasvocos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gatsby-sanity-shopify's Issues

Cannot get description field from Shopify in Sanity or Gatsby

Describe the bug
With the project up and running I noticed that while I was getting most of the product data back in the GraphQL queries from Sanity. However, the description text box on the Sanity Studio doesn't show anything.
The text box is just blank and it says "Click to Active"

So, I decided to open up the GraphiQL playground on the local Gatsby build.
I ran both the allSanityProduct and the sanityProduct queries to see if I could find it buried somewhere ๐Ÿคทโ€โ™‚๏ธ
When I query content or description fields they all get returned as null ๐Ÿ˜ข

To Reproduce
Steps to reproduce the behavior:

  1. Start up working Sanity Studio in /studio/ with sanity start
  2. Open up local Studio at http://localhost:3333
  3. Navigate to the Products Section
  4. Notice that "Product Description" is blank.
  5. Run a bunch of queries through Gatsby's GraphiQL explorer

Expected behavior
That the product description data would have been passed along with all the other data from Shopify to Sanity.
In studio/schemas/product.js the schema references productDescription field, but it seems to be empty.

Screenshots
Here's a screenshot of the local Sanity Studio with the Procut Description text box blank.
There is data on the Shopify store that should show up.

sanity-studio

Desktop (please complete the following information):

  • OS: Windows 10 Home
  • Browser [Chrome, FireFox, Edge]
  • Version [87.0.4280.141, 84.0.2, 87.0.664.75]

Additional context
Here are the GraphQL queries that I tried running to get the description for any product

query MyQuery {
  allSanityProduct {
    edges {
      node {
        internal {
          content
          contentDigest
          description
        }
        productDescription {
          children {
            text
          }
        }
      }
    }
    nodes {
      internal {
        content
        contentDigest
        description
      }
      title
      productDescription {
        children {
          text
        }
      }
      variants {
        internal {
          content
          contentDigest
        }
        productDescription {
          children {
            text
          }
        }
      }
    }
  }
}

And here's the JSON data I got back:

{
  "data": {
    "allSanityProduct": {
      "edges": [
        {
          "node": {
            "internal": {
              "content": null,
              "contentDigest": "71ebec409bd850721f517459be595901",
              "description": null
            },
            "productDescription": null
          }
        },
        {
          "node": {
            "internal": {
              "content": null,
              "contentDigest": "b2ba54f33b95a0172fa3bc8f19f2cc76",
              "description": null
            },
            "productDescription": null
          }
        }
      ],
      "nodes": [
        {
          "internal": {
            "content": null,
            "contentDigest": "71ebec409bd850721f517459be595901",
            "description": null
          },
          "title": "Pants",
          "productDescription": null,
          "variants": []
        },
        {
          "internal": {
            "content": null,
            "contentDigest": "b2ba54f33b95a0172fa3bc8f19f2cc76",
            "description": null
          },
          "title": "Example T-Shirt",
          "productDescription": null,
          "variants": [
            {
              "internal": {
                "content": null,
                "contentDigest": "86ffc29b8f258159c2ed008af670ac2c"
              },
              "productDescription": null
            },
            {
              "internal": {
                "content": null,
                "contentDigest": "86322b6f8e735714bde503590091a348"
              },
              "productDescription": null
            }
          ]
        }
      ],
      "group": [
        {
          "nodes": [
            {
              "internal": {
                "content": null,
                "description": null
              }
            }
          ]
        },
        {
          "nodes": [
            {
              "internal": {
                "content": null,
                "description": null
              }
            }
          ]
        }
      ]
    }
  },
  "extensions": {}
}

Sanity error: ClientError: The mutation(s) failed: mutation failed... Insufficient permissions; permission "create" required

Hello! Everything is connected and everything deploys fine but when I use Shopify to either send a test request or update a product, the Shopify function catches an error. I'm pretty sure Netlify has all the permissions and variables it needs. I'm sure this is something simple but I'm having a hard time debugging this.

Sanity error 4: ClientError: The mutation(s) failed: mutation failed on document "788032119674292900": Insufficient permissions; permission "create" required at onResponse (/var/task/src/node_modules/@sanity/client/lib/http/request.js:27:13) at /var/task/src/node_modules/get-it/lib-node/util/middlewareReducer.js:10:22 at Array.reduce (<anonymous>) at applyMiddleware (/var/task/src/node_modules/get-it/lib-node/util/middlewareReducer.js:9:29) at onResponse (/var/task/src/node_modules/get-it/lib-node/index.js:81:22) at /var/task/src/node_modules/get-it/lib-node/index.js:48:55 at callback (/var/task/src/node_modules/get-it/lib-node/request/node-request.js:57:46) at /var/task/src/node_modules/get-it/lib-node/request/node-request.js:141:14 at DestroyableTransform.<anonymous> (/var/task/src/node_modules/simple-concat/index.js:7:13) at Object.onceWrapper (events.js:420:28) { response: { body: { error: [Object] }, url: '***************************************', method: 'POST', headers: { 'content-type': 'application/json; charset=utf-8', 'content-length': '349', 'x-sanity-shard': '*********************', 'x-served-by': '*************', date: '********************', vary: 'Origin', xkey: 'project-************, project-******************', via: '1.1 google', 'alt-svc': 'clear', connection: 'close' }, statusCode: 403, statusMessage: 'Forbidden' }

Sync product deletions

First off, thanks for making this! I hadn't even thought of syncing Shopify products with a 3rd-party CMS.

Am I correct in assuming that the lambda function currently handles product creation and update, but doesn't deal with product deletions? That'd be great to have, even if behind a flag. I guess there's no harm in deleting datasets though if the source of truth is Shopify's database.

Images

Hi Lucas, thank you very much for putting this together. I had a couple issues with the instructions and some outdated packages, but was able to get things running.

One thing that doesn't quite appear to be working is images, they're not coming into Sanity from Shopify. I'm not seeing anything in functions/shopify.js that handles them. Am I missing anything, or does this functionality not exist right now?

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.