royderks / saleor-strapi-stitching

19 stars 5 forks source link

Stitching demo not working #1

Open adamszlag opened 2 years ago

adamszlag commented 2 years ago

I've encountered some issues with stitching in this example(I've recreated all steps form video):

  1. Error: Unknown type "Strapi_Products". Did you mean "Strapi_Product" in cmsMetaData: [Strapi_Products]
  2. if you change this to cmsMetaData: [Strapi_Product], the data structure is different , you need query like this to get saleorId : query getProducts($sort: [String]) { products(sort:$sort) { data { id attributes { saleorId } } } } 3.You need to add channel: "default-channel" on product query for saleor data
  3. I am able to run this without the error so the page loads correctly, but only if there is no stitching (data from Strapi added).

All that time I am able to get the data from Strapi (http://localhost:1337/graphql) endpoint and Stitched(http://localhost:3000/api/graphql). So the endpoints are working, also I am not able to get the data from your query, I am not sure if the structure of Strapi is changed with new versions, or what is causing the problems here.

Do you know how to solve those issues?

amityweb commented 2 years ago

Did you manage to find a solution?

royderks commented 2 years ago

@adamszlag @amityweb I've updated the code in this repository, which should fix your issues. The example will use StepZen in favor of schema stitching, as this declarative approach is easier to understand and more scalable.

amityweb commented 2 years ago

Thats great you updated the example to one which can work now, and is easier, thanks for that. Although StepZen looks to be an online 3rd party GraphQL generator as opposed on one built into the app now? So its a bit of a shame to move to that and not have detail how to do it locally anymore. Its surprising how much lack of examples/instructions there are online for this. I managed to get it working as far as failing at the Strapi query I think, so I have also asked in the Strapi forum about it to see if anyone there can help. I wonder if its Strapi that has been updated and requires a slightly different query to the one you previously supplied.

Thanks

aarajbhattarai commented 2 months ago

@amityweb @royderks Did you find the solution to run it locally?

amityweb commented 2 months ago

No we abandoned this. I realise things like this are just too complex sometimes, I am a web developer and wasting too much time on it. I figured out you dont really need stitching, it can all be done with queries to the two systems. So for example, I fetch products in one system, then using the product ID on a product page fetch the details from the other system. Its no big deal so no need to merge both into a 3rd party schema.

Seeing as our site is pre-built into static HTML any additional resources is only at build time and wont affect the site performance itself so its fine.

We also abandoned Saleor as they now have a Docker requirement, so I could not figure out how to move form the old Heroku recommended deployment to Docker. Again, was spending so much time on issues due to bad documentation we moved to something else.

There is nothing special about Saleor that other eCommerce systems can't do. Their documentation is so bad we just abandoned it and now use some other well known system that just works so we can get back to what matters... building websites!