chec / commercejs-nextjs-demo-store

Commerce demo store built for the Jamstack. Built with Commerce.js, Next.js, and can be one-click deployed to Netlify. Includes product catalog, customer login, categories, variants, cart, checkout, payments (Stripe) order confirmation, and printable receipts.
https://commercejs-demo-store.netlify.app/
BSD 3-Clause "New" or "Revised" License
1.07k stars 206 forks source link

Seeding is incomplete #140

Closed thdoan closed 3 years ago

thdoan commented 3 years ago

Steps to reproduce:

  1. Set CHEC_PUBLIC_KEY and CHEC_SECRET_KEY to your own keys in .env
  2. Run yarn seed

It should run successfully and output something like this:

√ Completed seeding
Added:
  3 categories
  9 products
  27 assets
Done in 70.70s.
  1. Run yarn dev

Actual behavior: no products are visible in the store. Expected behavior: 9 products should be visible in the store.

image

robbieaverill commented 3 years ago

Hi there, did your yarn seed run successfully and output what you shared above?

thdoan commented 3 years ago

After some investigation, I think I know what might be the root cause of all this -- when I originally ran yarn seed it failed with this error, possibly because I used the sandbox key/secret in .env:

$ yarn seed
yarn run v1.22.5
$ chec-seed seeds
Could not push an object to the assets endpoint (Response code 504 (Gateway Time-out)):
- Seeding assets #21. This may take some time...⚠️   Cannot read property 'id' of undefined
error Command failed with exit code 1.

After this, I updated .env with the standard key/secret and re-ran yarn seed, which ran successfully:

$ yarn seed
yarn run v1.22.5
$ chec-seed seeds
Could not push an object to the categories endpoint (Response code 422 (Unprocessable Entity)):
Could not push an object to the categories endpoint (Response code 422 (Unprocessable Entity)):
Could not push an object to the categories endpoint (Response code 422 (Unprocessable Entity)):
√ Completed seeding
Added:
  9 products
  27 assets
Done in 70.70s.

However, I think the products were not linked to the categories, as I have confirmed in the Chec portal:

image

After assigning products to categories everything looks good now.