Closed Uttam92477 closed 1 year ago
@Uttam92477 I recommand to use a custom action to save API url in state (bot, temp or session) it depends in your needs, then try to access.
temp.EXPOSED_API_URL = process.env.EXPOSED_API_URL
@Uttam92477 I recommand to use a custom action to save API url in state (temp or session) it depends in your needs, then try to access.
temp.EXPOSED_API_URL = process.env.EXPOSED_API_URL
That's a workaround and thanks for sharing the same however, I am more interested in knowing why I am not able to directly access the environment variables and how to fix it.
I think (please correct me when I remember incorrectly) that this has to do with the sandboxing of Actions, which may use additional dependencies. To protect all parameters in the env (and most importantly credentials saved in there) from any external scripts and their dependencies. In contrast to that Hooks have a similar sandbox, but they have access to process.env.EXPOSED_* by default, as you usually don't load additional npm modules in Hooks.
So this is a feature, not a bug :P
Describe the bug I have started botpress with environment variable EXPOSED_API_URL. I am able to print the environment variable using
bp.logger.info(process.env.EXPOSED_API_URL)
in custom action.However, when I am attempting to access the variable using {{process.env.EXPOSED_API_URL}} in Call API built-in action, I am not getting the variable (an empty for URL hostname is coming because of this)
To Reproduce Steps to reproduce the behavior:
Expected behavior The variable should be available.
Botpres config information version 12.22.2 Executing as docker using AWS ECS Production flag enabled BPFS storage is database Database is postgre