lucasvocos / gatsby-sanity-shopify Goto Github PK
View Code? Open in Web Editor NEWUnopinionated bare-bones Gatsby + Sanity + Shopify starter
License: MIT License
Unopinionated bare-bones Gatsby + Sanity + Shopify starter
License: MIT License
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:
/studio/
with sanity start
http://localhost:3333
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.
Desktop (please complete the following information):
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": {}
}
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' }
hi! what is the netlify build command?
Thank you for sharing!
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.
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.