QuestionQ20

Troubleshoot infrastructure and configuration issues

A single Adobe Commerce Cloud instance is configured with two websites, each containing one store view and using different domains.

  • The default website is website_one, with store view store_one and domain storeone.com.
  • The second website is website_two, with store view store_two and domain storetwo.com.

The magento-vars.php file is configured as follows to determine which website each request runs against:

Question Image

During testing of a new GraphQL integration, every request returned data for the default website, irrespective of the domain.

What is the cause of this issue?

  • A The magento-vars.php file is not processed for any GraphQL requests, so the default website is always processed.
  • B $_SERVER[“MAGE_RUN_CODE”] needs to be set to store and $_SERVER[“MAGE_RUN_TYPE”] needs to be set to the store code instead.
  • C GraphQL requests are always run against the default store view unless a Store header or store cookie is provided.
Explanation

Adobe Commerce GraphQL uses the Store HTTP header to select the store view for a request. When that header is absent, GraphQL uses the default store view; an existing store cookie can also establish the store context. Domain-based MAGE_RUN_CODE website selection does not by itself make an otherwise headerless GraphQL request use the corresponding non-default store view.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!