Giter Club home page Giter Club logo

gridsome-source-shopify's People

Contributors

cameronrr avatar dependabot[bot] avatar renovate-bot avatar renovate[bot] avatar rylanharper avatar terabytetiger avatar travis-r6s avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

gridsome-source-shopify's Issues

Timeout Error getting Products

Hello,
I've been experiencing this issue frequently, but cannot figure out why I sometimes get this error. Unsure if this is related to Shopify or something else.

Error: Timeout: {
  "response": {
    "errors": [{
      "message": "Timeout"
    }],
    "status": 200
  },
  "request": {
    "query": "\n  query GetProducts($first: Int!, $after: String) {\n    data: products (first: $first, after: $after) {\n      pageInfo {\n        hasNextPage\n      }\n      edges {\n        cursor\n        node {\n          collections (first: $first) {\n            edges {\n              node {\n                id\n              }\n            }\n          }\n          images(first: 250) {\n            edges {\n              node {\n                id\n                altText\n                originalSrc\n              }\n            }\n          }\n          variants(first: 250) {\n            edges {\n              node {\n                availableForSale\n                compareAtPrice: compareAtPriceV2 {\n                  amount\n                  currencyCode\n                }\n                id\n                image {\n                  altText\n                  id\n                  originalSrc\n                }\n                price: priceV2 {\n                  amount\n                  currencyCode\n                }\n                selectedOptions {\n                  name\n                  value\n                }\n                sku\n                title\n                weight\n                weightUnit\n              }\n            }\n          }\n          availableForSale\n          createdAt\n          description\n          descriptionHtml\n          handle\n          id\n          onlineStoreUrl\n          options {\n            id\n            name\n            values\n          }\n          priceRange {\n            minVariantPrice {\n              amount\n              currencyCode\n            }\n            maxVariantPrice {\n              amount\n              currencyCode\n            }\n          }\n          productType\n          publishedAt\n          tags\n          title\n          updatedAt\n          vendor\n          metafields(first: 250) {\n            edges {\n              node {\n                key\n                value\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n",
    "variables": {
      "first": 100,
      "after": "eyJsYXN0X2lkIjo0MTE3ODUxNTcwMjY0LCJsYXN0X3ZhbHVlIjoiNDExNzg1MTU3MDI2NCJ9"
    }
  }
}

Query more than 250 products pro collection

Hey,

is it possible to query for more than 250 products pro collection. I have a rather large collections with around 1000 products. I saw in your source plugin, that you limit the products to 250. I thought I can maybe overwrite this in my page-query, but unfortunately that doesn't work.

<page-query>
query Collection ($id: ID!) {
  shopifyCollection (id: $id) {
    id
    title
    description
    products (limit: 500) {
      id
      title 
    }
  }
}
</page-query>

Thank you very much for your help.
Best regards
Chris

Getting storefrontToken is not defined

Hi there,

I am pretty new to working with gridsome, but trying to get some products from Shopify to read into my local dev project. I have created my storefrontToken using the create private app in the Shopify admin but keep getting:

gridsome.config.js: <my store front api token> is not defined

any thoughts on what I am doing wrong? Any help is greatly appreciated!

-Chris

Getting an issue when attempting to run gridsome build

Issue description

When running gridsome build the build process unexpectedly stopped because of the following error :

Initializing plugins...
Loading data from https://test_store_08B.myshopify.com

TypeError: Cannot read property 'data' of undefined
    at Object.transform (/Users/test_account/git/portfolio_shopify/node_modules/gridsome-source-shopify/lib/index.js:337:21)
    at AsyncGeneratorFunction.paginateEach [as each] (/Users/test_account/git/portfolio_shopify/node_modules/got/dist/source/create.js:180:45)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async queryAll (/Users/test_account/git/portfolio_shopify/node_modules/gridsome-source-shopify/lib/index.js:358:37)
    at async ShopifySource.getProductTypes (/Users/test_account/git/portfolio_shopify/node_modules/gridsome-source-shopify/lib/index.js:547:29)
    at async /Users/test_account/git/portfolio_shopify/node_modules/gridsome-source-shopify/lib/index.js:526:7
    at async Plugins.run (/Users/test_account/git/portfolio_shopify/node_modules/gridsome/lib/app/Plugins.js:141:11)

Issue investigation

I first though it was my mistake by accidentally entering a wrong shop name or storefront token, so verified and even tried to input a wrong one manually to see what happens. The plugin have a clear error for wrong credentials so this is not linked to it.

I checked to see if my test shop was empty, but I had already added 2 products into two collections.

Steps I followed

  • Created a new shopify shop
  • Added a couple of mock products ( 4 products in two collections )
  • Created a new private app and given it read and write access to everything
  • Enabled the storefront API
  • Made sure all products and collections had the private app as their sales channel
  • Copied the shop name and the storefront token to my project and setup the plugin as per the documentation
  • Got the error
  • Tried the same credentials in the shopify starter example to make sure my code was not interfering, got the same error.

Notes

It is highly possible that this error is due to an error configuring shoppify, although it seems to me I followed the steps correctly I am pretty new to the storefront API.

Cannot get metafileds in ShopifyProduct

I'm trying to get metafields from products, but I get an error. Here is my request

query Products {
  allShopifyProduct {
    edges {
      node {
        id
        tags
        metafields
      }
    }
  }
}

And the error

{
  "error": {
    "errors": [
      {
        "message": "Cannot query field \"metafields\" on type \"ShopifyProduct\".",
        "stringified": "Cannot query field \"metafields\" on type \"ShopifyProduct\".\n\nGraphQL request:7:9\n6 |         tags\n7 |         metafields\n  |         ^\n8 |       }"
      }
    ]
  }
}

It is possible to use metafields?

Trying to get comments in allShopifyArticle

Hello, I'm trying to get comments in allShopifyArticle query and it show that attribute is not available, what could be the problem?

Here is my query

query Publications {
  allShopifyArticle {
    edges {
      node {
        handle
        id
        image {
          originalSrc
        }
        seo {
          description
        }
        comments(first: 10) {
          edges {
            cursor
            node {
              author {
                email
              }
              content
            }
          }
        }
        title
        publishedAt
        
      }
    }
    totalCount
  }
}

Here is my error

{
  "error": {
    "errors": [
      {
        "message": "Cannot query field \"comments\" on type \"ShopifyArticle\". Did you mean \"content\"?",
        "stringified": "Cannot query field \"comments\" on type \"ShopifyArticle\". Did you mean \"content\"?\n\nGraphQL request:13:9\n12 |         }\n13 |         comments(first: 10) {\n   |         ^\n14 |           edges {"
      }
    ]
  }
}

I'm not sure what could be the problem. Please some help

Pass Accept-Language header to query

Hello everyone.

I want to build a headless e-commerce with Shopify, Gridsome and the source-shopify-plugin. The site should be multilingual. Shopify provides an api-endpoint to add translations to products, collections, ... To receive translated content, the header needs to contain: "Accept-Language: ". According to the shopify docs it is not possible to do a query with a locale request parameter.

Is there any way to get translated content from shopify storefront-api?

Thank you

Query Pages/Articles

Hey guys,

I love the source plugin. It works really good. I try to query the pages of Shopify. Unfortunately I get an error:

"Error: Cannot query field "title" on type "ShopifyPage"."

I also get this error, when I try to query articles, but I don't get the error, when I try to query products, collections, etc.

I double check the permissions and I also created a page.

Thanks in advance for your help.

Best regards
Chris

Cannot get SEO in shopifyProduct

Hi,

I'm having an error trying to get the SEO information in shopifyProduct mutation, here is my query

query Product($id:ID) {
  shopifyProduct(id: $id) {
    title
    description
    handle
    vendor
    productType
    seo {
      title
      description
    }
  }
}

Is there any chance I can get that info?

Thank you

Possible client update?

Hey Travis,

Hope you have been well! I still use this plugin often when developing Shopify stores for clients and it always works wonderfully - thanks for all the effort put into this.

I am slowly moving over to Nuxt since it seems Gridsome hasn't been updated in a while (although its definitely not as easy to set up as Gridsome is), but in the meantime I was wondering if it would be possible to update the Api client to the latest 2022-7 version? There has been some parts added to the graphql api and it would be great to make use of them.

If not its totally cool. I get that this may no longer be in your "stack" since there hasn't been much Gridsome updates (although a small update did happen last week for Vue 2.7).

Also, if you haven't seen it, I updated that old Shopify/Sanity repo you helped me on a long time ago which is on my Github page!

Allocation failure scavenge might not succeed

I'm hoping to gain some insight into an error I've encountered, and whether it's related to gridsome-source-shopify, gridsome itself, or something else.

Firstly, I'll note that when I attempted to run gridsome develop, it appeared that this plugin was failing with a timeout. I read that it would help to reduce the number of products fetched on each request. So I set the limit to 10:

{
  use: 'gridsome-source-shopify',
  options: {
    storeName: process.env.GRIDSOME_SHOPIFY_STOREFRONT,
    storefrontToken: process.env.GRIDSOME_SHOPIFY_STOREFRONT_TOKEN,
    perPage: 10
  }
}

This allowed the process to proceed without timeouts. However, after a few hours, the process failed throwing errors:

allocation failure scavenge might not succeed
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

For context, I'm working with a Shopify catalog that contains a little over 40,000 products, where each product typically has about 50 variants. It's quite a substantial catalog of products and I suspect it's why I was encountering the timeouts initially.

I'm trying to identify / better understand the cause of these errors, so that I can dig a bit deeper into the issue. Here's the full output:

Gridsome v0.7.23

Initializing plugins...
Loading data from https://xxxxxxxxxx.myshopify.com

<--- Last few GCs --->

[3356:00000247D24D6FD0] 12355663 ms: Mark-sweep 3858.3 (4132.7) -> 3855.3 (4130.1) MB, 535.3 / 0.0 ms  (average mu = 0.292, current mu = 0.290) allocation failure scavenge might not succeed
[3356:00000247D24D6FD0] 12356932 ms: Mark-sweep 3858.3 (4132.7) -> 3855.4 (4130.3) MB, 1026.3 / 0.0 ms  (average mu = 0.233, current mu = 0.191) allocation 
failure scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6A37803DF napi_wrap+109311
 2: 00007FF6A3725096 v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::NumberOfElementsOffset+33302
 3: 00007FF6A3725E66 node::OnFatalError+294
 4: 00007FF6A3FF070E v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF6A3FD558D v8::SharedArrayBuffer::Externalize+781
 6: 00007FF6A3E7FA1C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1516
 7: 00007FF6A3E8AD5A v8::internal::Heap::ProtectUnprotectedMemoryChunks+1258
 8: 00007FF6A3E87F09 v8::internal::Heap::PageFlagsAreConsistent+2457
 9: 00007FF6A3E7CB31 v8::internal::Heap::CollectGarbage+2033
10: 00007FF6A3E7AD35 v8::internal::Heap::AllocateExternalBackingStore+1317
11: 00007FF6A3E94FD6 v8::internal::Factory::AllocateRaw+166
12: 00007FF6A3EA89F4 v8::internal::FactoryBase<v8::internal::Factory>::NewFixedArrayWithFiller+84
13: 00007FF6A3E9CEB9 v8::internal::Factory::NewJSArrayStorage+201
14: 00007FF6A3E9C506 v8::internal::Factory::NewJSArray+150
15: 00007FF6A3D59CA5 v8::internal::FeedbackNexus::ic_state+59141
16: 00007FF6A3F99415 v8::internal::Builtins::builtin_handle+303781
17: 00007FF6A3F970C6 v8::internal::Builtins::builtin_handle+294742
18: 00007FF6A3F96B03 v8::internal::Builtins::builtin_handle+293267
19: 00007FF6A407919D v8::internal::SetupIsolateDelegate::SetupHeap+464173
20: 00007FF6A4011AA2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
21: 00007FF6A403E890 v8::internal::SetupIsolateDelegate::SetupHeap+224288
22: 00007FF6A40BAC8E v8::internal::SetupIsolateDelegate::SetupHeap+733214
23: 00007FF6A4031A0D v8::internal::SetupIsolateDelegate::SetupHeap+171421
24: 00007FF6A400F64C v8::internal::SetupIsolateDelegate::SetupHeap+31196
25: 00007FF6A3EDF8EF v8::internal::Execution::CallWasm+1839
26: 00007FF6A3EDF9FB v8::internal::Execution::CallWasm+2107
27: 00007FF6A3EE043A v8::internal::Execution::TryCall+378
28: 00007FF6A3EC0C55 v8::internal::MicrotaskQueue::RunMicrotasks+501
29: 00007FF6A3EC09B0 v8::internal::MicrotaskQueue::PerformCheckpoint+32
30: 00007FF6A3F9D92F v8::internal::Builtins::builtin_handle+321471
31: 00007FF6A3F9CEC4 v8::internal::Builtins::builtin_handle+318804
32: 00007FF6A3F9D1B7 v8::internal::Builtins::builtin_handle+319559
33: 00007FF6A3F9D003 v8::internal::Builtins::builtin_handle+319123
34: 00007FF6A407919D v8::internal::SetupIsolateDelegate::SetupHeap+464173
35: 00007FF6A4011AA2 v8::internal::SetupIsolateDelegate::SetupHeap+40498
36: 00007FF6A400F75E v8::internal::SetupIsolateDelegate::SetupHeap+31470
37: 00007FF6A400F34C v8::internal::SetupIsolateDelegate::SetupHeap+30428
38: 00007FF6A3EDF831 v8::internal::Execution::CallWasm+1649
39: 00007FF6A3EDF09F v8::internal::Execution::Call+191
40: 00007FF6A3FCA9E7 v8::Function::Call+615
41: 00007FF6A37A412D node::CallbackScope::~CallbackScope+861
42: 00007FF6A37A446B node::CallbackScope::~CallbackScope+1691
43: 00007FF6A379C124 v8::internal::compiler::Operator::EffectOutputCount+228
44: 00007FF6A36586C3 v8::internal::Isolate::isolate_root_bias+54099
45: 00007FF6A37D7D90 uv_timer_stop+560
46: 00007FF6A37D7E67 uv_timer_stop+775
47: 00007FF6A37D469B uv_async_send+331
48: 00007FF6A37D3E2C uv_loop_init+1292
49: 00007FF6A37D3FCA uv_run+202
50: 00007FF6A36E00A5 v8::internal::OrderedHashTable<v8::internal::OrderedHashSet,1>::NumberOfBucketsOffset+9365
51: 00007FF6A3753867 node::Start+311
52: 00007FF6A35B686C RC4_options+339820
53: 00007FF6A455523C v8::internal::compiler::RepresentationChanger::Uint32OverflowOperatorFor+153532
54: 00007FF9DC867034 BaseThreadInitThunk+20
55: 00007FF9DD5E2651 RtlUserThreadStart+33
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! my-gridsome-site@ develop: `gridsome develop`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the my-gridsome-site@ develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxxxxxxxxx\AppData\Roaming\npm-cache\_logs\2021-08-14T14_32_04_821Z-debug.log

ProductVariants as a first class content type

Hey there, thx for the plugin it has been useful already!

It would be really useful to pull in the ProductVariants too, so one can query based on that.
The main use case for this for me is that Contentful's Shopify product picker integration returns a Variant ID instead of a Product ID.
https://www.contentful.com/developers/docs/extensibility/apps/shopify/

I am trying to get this project just done now so I wont have time to submit a PR , but if you think this would be a quick fix would be awesome to see this land soon! ๐Ÿ˜„

thx!

Query metafields in product query

Hey guys,

it would be awesome, if you add the possibility to also query for metafields in the product query.

Thank you very much for your answer in advance.

Best regards
Chris

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.