Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Curl command in AEM doesn't work in higher environments with Basic Auth

Avatar

Level 4

I'm trying to execute curl command to upload a package in higher environments in AEMaaCS by passing Basic Auth.

List of common AEM cURL commands | Adobe Experience Cloud

But it throws an error :

 

 

 

503client read error

 

 

 

curl-error.png

I'm passing user credentials as Basic Authentication. No issue related to permissions.

Note: It works when I try in localhost. 

Please help!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

@rakesh_h2 

 

1. We did with Service Accounts for Servers and credentials for local. You need to set up permissions for the service account, once its configured. 

 

2. Programmatically, we will need HTTP or Curl. In both cases, we are creating packages. The timeout affect both of them. Hence, we have created multiple packages with smaller filters.

 

 

Also, please explore the Content Copy Tool https://experienceleague.adobe.com/docs/experience-manager-cloud-manager/content/using/content-copy....

 

It has been recently released by Adobe for sync from Higher to Lower environments. Vice versa is not allowed


Aanchal Sikka

View solution in original post

12 Replies

Avatar

Community Advisor

Are you sure the package manager is enabled in the AEMaaCS environment? (Keep in mind that this is usually disabled for prod environments), because It looks like the URL is not available, that's why you are getting 503



Esteban Bustamante

Avatar

Level 4

@EstebanBustamante The screenshot is of dev author environment's. But I'm able to access prod author's package manager as well. That means curl should work, right?

Avatar

Community Advisor

Hi @rakesh_h2 , Can you generate service credentials for your environment and with the help of these credentials you should be able to generate JWT token and exchange it with IMS to get access token.

you can send this generated access token as a header in curl command
curl -H "Authorization: Bearer <your_ims_access_token>" https://<environment>/crx/packmgr/service/.json/?cmd=upload

Hope this helps,
Krishna

Avatar

Level 4

@krishna_sai Thanks for the response. Doesn't it work with Basic Authentication?

Avatar

Community Advisor

It should work with basic auth too. It might be possible to get 503 because of timeout
Just wanted to try the other way round to access the server

Avatar

Level 4

Server is accessible the other way. Just tried with a Developer token. But with Basic Auth, it doesn't work.

Avatar

Community Advisor

Please share the curl command that you executed on command line

with error response

Avatar

Level 4

@DPrakashRaj I tried in CLi with Basic Auth. No error. But its not getting uploaded.

curl-error-gitbash.png

Avatar

Community Advisor

Hi Rajesh,

can you check the file path again. I assume you are on windows machine and path band looks weird to me as all directory are separated by (\\ ) double slash except for the last on which is deprecated by one slash.

you can also try the curl command by putting the file to the same location from where you are executing it.

You can also refer to this document for showing the progress https://aemmastery.com/upload-and-install-package-via-curl-6e47898d7b1b

Avatar

Community Advisor

Hello @rakesh_h2 

 

For any server-to-server or API-based communications, Access tokens is the recommended way.

 

We have also noticed the 503 error recently. It is happening with large packages (caused by a time-out of approx 60 seconds) for CURL or HTTP commands. Mainly, we will observe these for download, build and upload commands.

 

Try creating smaller packages, the Access Token should work.


Aanchal Sikka

Avatar

Level 4

Hi @aanchal-sikka , A few questions:

1. CURL doesn't work with Basic Auth at all?

2. Even if I try with Access token, it works only for packages with smaller size? If so, what's the recommended way to build or install or upload bigger packages programmatically?

Avatar

Correct answer by
Community Advisor

@rakesh_h2 

 

1. We did with Service Accounts for Servers and credentials for local. You need to set up permissions for the service account, once its configured. 

 

2. Programmatically, we will need HTTP or Curl. In both cases, we are creating packages. The timeout affect both of them. Hence, we have created multiple packages with smaller filters.

 

 

Also, please explore the Content Copy Tool https://experienceleague.adobe.com/docs/experience-manager-cloud-manager/content/using/content-copy....

 

It has been recently released by Adobe for sync from Higher to Lower environments. Vice versa is not allowed


Aanchal Sikka