AEMaaCS | Unable to read cloud environment and secret variables from AEM cloud in AEM OSGI config | Community
Skip to main content
New Participant
October 19, 2023
Solved

AEMaaCS | Unable to read cloud environment and secret variables from AEM cloud in AEM OSGI config

Hi,
cc @kautuk_sahni 
I am unable to read the environment and secret variables from AEM cloud in my OSGI config (ui.config/src/main/content/jcr_root/apps/proj/osgiconfig/config.author.dev/com.proj.service.impl.ServiceImpl.config.cfg.json)

{
    "apiUrl": "$[env:EFIX_BACKEND_URL;default=https://some.value.foo/bar]",
    "secretKey": "$[secret:EFIX_BACKEND_USER]",
    "secretVal": "$[secret:EFIX_BACKEND_PASSWORD]",
    "timeout:Integer":1000
}


We have the environment and secret variables from AEM cloud author as below:

Am i missing something? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
EstebanBustamante
EstebanBustamanteAccepted solution
New Participant
October 20, 2023

The variable definition looks correct. I would suggest checking how you are retrieving the values. Please look at this post, which has a full example of how to use the variables once set up https://medium.com/slalom-technology/how-to-use-environment-variables-in-adobe-experience-manager-aem-as-cloud-service-1e9145d78c2c 

Esteban Bustamante

6 replies

Level 3
September 20, 2025

I know this post is 2 years old, but I'm encountering the same issue.
Were you able to resolve it? If so, could you please share the details?

Translate
kautuk_sahni
Employee
October 26, 2023

@estebanbustamante Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.

Translate
Kautuk Sahni
EstebanBustamante
New Participant
October 19, 2023

Can you verify you don't have a run mode selection conflict?

Something like another config under ui.config/src/main/content/jcr_root/apps/proj/osgiconfig/config.author/com.proj.service.impl.ServiceImpl.config.cfg.json

 

 

Translate
Esteban Bustamante
New Participant
October 20, 2023

@estebanbustamante  thanks for your response. 
On AEM Cloud DEV we can see the config for the pid com.proj.service.impl.ServiceImpl.config which confirms the runmode is fine, but these osgi config values with expression are not getting replaced from the cloud environment and secret variables as we can see in logs the StringUtils.isNotBlank() is returning false for the config value in service. 

Translate
EstebanBustamante
EstebanBustamanteAccepted solution
New Participant
October 20, 2023

The variable definition looks correct. I would suggest checking how you are retrieving the values. Please look at this post, which has a full example of how to use the variables once set up https://medium.com/slalom-technology/how-to-use-environment-variables-in-adobe-experience-manager-aem-as-cloud-service-1e9145d78c2c 

Translate
Esteban Bustamante