MagentoGraphqlClient | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

13 replies

Level 2
Dec 28, 2023 4:03 AM UTC

Any luck with this issue? I am having the same problem with my custom product component.

MagentoGraphqlClient is not getting injected in my CustomProductImpl even though I have all required OSGI configurations done. Due to this, I am getting magentoGraphqlClient object as null. I kept debug pointer in OOTB ProductImpl as well, and over there I can see the object is getting initialised. 


Strange thing, the injection in my local works fine some times and some times it doesn’t. In AEM cloud Dev ,magentoGraphqlClient is always null.

Translate
HeenaMadan
New Participant
Dec 28, 2023 9:48 AM UTC

Have you configured commerce endpoint in AEM cloud instance? If not, it will give you null magentoGraphql client

Translate
Level 2
Dec 28, 2023 12:51 PM UTC

yep, that's configured in cloud manager. All OSGI configs are also fine. 

all dependencies and embeds are done in pom files. 

Translate
HeenaMadan
New Participant
Nov 9, 2022 2:18 PM UTC

Add store/ url required details in OSGI config - com.adobe.cq.commerce.graphql.client.impl.GraphqlClientImpl~<identifier>.cfg.json

then create cloudconfig of the store view

  1. In AEM go to Tools -> Cloud Services -> CIF Configuration

  2. Select the commerce configuration you want to change

  3. Open the configuration properties via the action bar

and configure to site hierarchy

 

Refer detailed adobe doc https://experienceleague.adobe.com/docs/experience-manager-65/commerce/storefront/getting-started.html?lang=en#:~:text=In%20AEM%20go%20to%20Tools,properties%20via%20the%20action%20bar

backend side to get MagentoGraphqlClient object:

MagentoGraphqlClient magentoGraphQLclientObject = resource.adaptTo(MagentoGraphqlClientImpl.class): request.adaptTo(MagentoGraphqlClientImpl.class);  
Translate
Level 2
Nov 10, 2022 11:31 AM UTC

Hi Heena Madan,

Getting  build error while using 

MagentoGraphqlClient magentoGraphQLclientObject = resource.adaptTo(MagentoGraphqlClientImpl.class);

 

[ERROR] The analyser found the following errors for author and publish :
[ERROR] [api-regions-exportsimports] com.aem.magento:aem-magento.core:1.0.0-SNAPSHOT: Bundle aem-magento.core:1.0.0-SNAPSHOT is importing package(s) com.adobe.cq.commerce.core.components.internal.client in start level 20 but no bundle is exporting these for that start level. (com.aem.magento:aem-magento.all:1.0.0-SNAPSHOT)

 

I have used,

<dependency>
<artifactId>core-cif-components-core</artifactId>
<version>2.12.0</version>
<groupId>com.adobe.commerce.cif</groupId>
<scope>provided</scope>
</dependency>

 

Translate
HeenaMadan
New Participant
Nov 10, 2022 2:43 PM UTC

If bundle is not found at start level 20- you need to export these jars. embed required cif and magento jar in "all" module 

<!-- Adobe CIF Dependencies -->
                        <embedded>
                            <groupId>com.adobe.commerce.cif</groupId>
                            <artifactId>core-cif-components-apps</artifactId>
                            <type>zip</type>
                            <target>/apps/project-packages/application/install</target>
                        </embedded>
                        <embedded>
                            <groupId>com.adobe.commerce.cif</groupId>
                            <artifactId>core-cif-components-config</artifactId>
                            <type>zip</type>
                            <target>/apps/project-packages/application/install</target>
                        </embedded>
                        <embedded>
                            <groupId>com.adobe.commerce.cif</groupId>
                            <artifactId>core-cif-components-core</artifactId>
                            <target>/apps/project-packages/application/install</target>
                        </embedded>
                        <embedded>
                            <groupId>com.adobe.commerce.cif</groupId>
                            <artifactId>magento-graphql</artifactId>
                            <target>/apps/<project-packages/application/install</target>
                        </embedded>
                        <embedded>
                            <groupId>com.adobe.commerce.cif</groupId>
                            <artifactId>graphql-client</artifactId>
                            <target>/apps/project-packages/application/install</target>
                        </embedded>

 

Translate
Mani_kumar_
New Participant
Nov 9, 2022 1:55 PM UTC

This article from Adobe gives you pretty much everything to start to CIF integration with AEM

https://experienceleague.adobe.com/docs/experience-manager-65/commerce/storefront/getting-started.html?lang=en#:~:text=In%20AEM%20go%20to%20Tools,properties%20via%20the%20action%20bar

 

Make sure you have all the details of the Magento client like URL, username, password and root category to pick the catalog data

This will be a cloud configuration that needs to be added which is explained in detail in the article.

Translate