Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

AEM CIF + Magento on Publish

Avatar

Avatar
Give Back
Level 1
evancooperman-r
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile

Avatar
Give Back
Level 1
evancooperman-r
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile
evancooperman-r
Level 1

05-05-2021

Hi everyone,

I'm struggling a bit to get my publish instance working properly with AEM + CIF (1.10.0) + Venia + Magento.  Everything works properly in author - I can view products, add to cart, and complete checkout.  My commerce config path is set as /api/graphql.

The problem is that in publish, I'm getting a 403 error when it attempts to hit the graphql endpoint:

http://localhost:4503/api/graphql

I have set up the COMMERCE_ENDPOINT environment variable and this is working as expected in author.

I checked the CSRF configuration and by default it only has the /graphql endpoint listed as ignoring CSRF, so I'm assuming that the publish endpoint cannot just be /api/graphql.  I tried adding /api/graphql to the CSRF config just for fun, but that didn't fix it. 

So my question is, in order for publish to work, do I have to set up a proxy and update my config in author (and then publish it) using that URL instead?  I actually tried changing the URL to hit Magento directly, but of course I get a CORS error, so there obviously needs to be a proxy somewhere...I just thought AEM could handle it internally for publish like it does for author.  Does anyone know if I absolutely need to set up a proxy for publish?  Even if I do use a proxy, I'm assuming I would want to use the dispatcher as my proxy so that I don't run into the CORS issue there too, and to avoid a second proxy, right?

I've tried scouring the docs but they all speak primarily to author, with almost nothing at all for how the publish setup differs.  The only thing I see is the following, which seems to indicate that AEM publish should function as it's own proxy the same way author does:

 

Example Mac OSX:

export COMMERCE_ENDPOINT=https://demo.magentosite.cloud/graphql
Example Windows:
set COMMERCE_ENDPOINT=https://demo.magentosite.cloud/graphql
This variable is used by AEM to connect to your commerce system. Also, the CIF add-on includes a local reverse proxy make the Commerce GraphQL endpoint available locally. This is used by the CIF authoring tools (product console and pickers) and for the CIF client-side components doing direct GraphQL calls.
 

Thanks in advance!

aemaacs CIF Magento venia

Replies

Avatar

Avatar
Give Back
Level 2
moek18753296
Level 2

Likes

9 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Give Back
Level 2
moek18753296
Level 2

Likes

9 likes

Total Posts

5 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
Boost 5
Boost 3
Boost 1
View profile
moek18753296
Level 2

10-05-2021

Are you logging in on the publisher first?  If not, I would check the Sling Authentication Service in the OSGi console is set to allow Anonymous access. https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-sites-locked-for-anony...

Avatar

Avatar
Give Back 10
MVP
shelly-goel
MVP

Likes

174 likes

Total Posts

330 posts

Correct Reply

87 solutions
Top badges earned
Give Back 10
Validate 1
Shape 1
Ignite 1
Give Back 5
View profile

Avatar
Give Back 10
MVP
shelly-goel
MVP

Likes

174 likes

Total Posts

330 posts

Correct Reply

87 solutions
Top badges earned
Give Back 10
Validate 1
Shape 1
Ignite 1
Give Back 5
View profile
shelly-goel
MVP

11-05-2021

@evancooperman-r  I hope you've activated your /conf/venia cloud configurations

Avatar

Avatar
Give Back
Level 1
evancooperman-r
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile

Avatar
Give Back
Level 1
evancooperman-r
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile
evancooperman-r
Level 1

12-05-2021

I did activate them, the URL it's attempting to hit in publish is the same as in author (but port 4503), but I'm getting the 403 error.

Avatar

Avatar
Give Back
Level 1
evancooperman-r
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile

Avatar
Give Back
Level 1
evancooperman-r
Level 1

Likes

0 likes

Total Posts

7 posts

Correct Reply

0 solutions
Top badges earned
Give Back
Ignite 1
View profile
evancooperman-r
Level 1

12-05-2021

Great thought, and for a minute I thought you were on to something! Unfortunately my Sling Authentication Service is already allowing anonymous access to the repo. I also tested again after logging in as admin, but getting the same issue still anyway.

Avatar

Avatar
Give Back 10
MVP
shelly-goel
MVP

Likes

174 likes

Total Posts

330 posts

Correct Reply

87 solutions
Top badges earned
Give Back 10
Validate 1
Shape 1
Ignite 1
Give Back 5
View profile

Avatar
Give Back 10
MVP
shelly-goel
MVP

Likes

174 likes

Total Posts

330 posts

Correct Reply

87 solutions
Top badges earned
Give Back 10
Validate 1
Shape 1
Ignite 1
Give Back 5
View profile
shelly-goel
MVP

05-06-2021

@evancooperman-r  Yes the graphql endpoint should be /api/graphql in publish as well. Where do you get 403?

Is your issue resolved?