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

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

  • October 19, 2023
  • 3 replies
  • 2269 views

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? 

Best answer by EstebanBustamante

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 

3 replies

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
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

 

 

Esteban Bustamante
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. 

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
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
kautuk_sahni
Community Manager
Community Manager
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.

Kautuk Sahni
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?