hlxsites / aem-boilerplate-commerce

Use this repository template for new AEM+Commerce projects.
https://main--aem-boilerplate-commerce--hlxsites.aem.live
Apache License 2.0
27 stars 23 forks source link

Issue with "Add to Cart" functionality in Adobe Storefront Boilerplate #224

Closed RoshanTekno closed 8 hours ago

RoshanTekno commented 2 days ago

Title: Issue with "Add to Cart" functionality in Adobe Storefront Boilerplate: ERR_CERT_AUTHORITY_INVALID error

Description: I'm using the Adobe Storefront Boilerplate with the default configuration provided. While fetching product details works as expected, I encounter an issue when clicking the "Add to Cart" button. Below are the details of the problem:

Steps to Reproduce:

  1. Set up the Adobe Storefront Boilerplate using the default configuration.
  2. Attempt to fetch product details (this works fine).
  3. Click the "Add to Cart" button.

Observed Behavior:

When attempting to add a product to the cart, the following error occurs:

POST https://mcprod.aemshop.net/graphql net::ERR_CERT_AUTHORITY_INVALID

Curl Request:

Here is the curl request used during the process:

curl 'https://mcprod.aemshop.net/graphql' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'Referer: https://main--aem-store-front--roshantekno.aem.page/' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' \
  -H 'sec-ch-ua: "Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \
  -H 'Content-Type: application/json' \
  -H 'Store: default' \
  -H 'sec-ch-ua-mobile: ?0' \
  --data-raw '{"query":"mutation createCart { cartId: createEmptyCart }","variables":{}}'

Response:

The response to the curl request is:

POST https://mcprod.aemshop.net/graphql net::ERR_CERT_AUTHORITY_INVALID

Expected Behavior:

The "Add to Cart" functionality should work without any errors and return a valid response from the GraphQL endpoint.

Additional Context:

Questions:

  1. Is there an issue with the SSL configuration of the provided GraphQL endpoint?
  2. Are there additional setup steps required to configure SSL certificates or trust authorities?

Environment:

Please advise on resolving this issue.

herzog31 commented 1 day ago

Hi @RoshanTekno,

I cannot reproduce the behaviour as the curl request provided works for me:

curl 'https://mcprod.aemshop.net/graphql' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'Referer: https://main--aem-store-front--roshantekno.aem.page/' \
  -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36' \
  -H 'sec-ch-ua: "Google Chrome";v="131", "Chromium";v="131", "Not_A Brand";v="24"' \
  -H 'Content-Type: application/json' \
  -H 'Store: default' \
  -H 'sec-ch-ua-mobile: ?0' \
  --data-raw '{"query":"mutation createCart { cartId: createEmptyCart }","variables":{}}'
{"data":{"cartId":"mtVTZqXJF55j1pg2tf79Zzdo6jHFAJi4"}}

Are you within a corporate network which has special TLS policies in place?

RoshanTekno commented 8 hours ago

I was using it on a corporate network, and it started working after I added a VPN. Thanks for your response!