REMINDER
Global Variables on Cloud Backend API Functions
-
Hello,
More info here:
https://changelog.appdrag.com/features/global-vars-on-cloudbackend-api-functions -
This is such a life-saver! Bravo!
-
That's a very very good news, omg, thanks a lot !
-
I literally wrote a SQL Select function JUST to get secrets from any function while requiring an API token for security..... now I can just use this
-
Okay... small issue.
Because it's passed in through the context variable, I can't access it outside the handler function, is that right?
Unlike the process.env function, the context variable is only available after being passed to the handler / invocation function.
I have a case where I need it outside the handler functinon. Is it possible?
importantVar = "this is the global variable I would like to use" doSomethingImportantWith(importantVar); exports.handler = (event, context, callback) => { // Rest of function goes here }
-
Hey,
Well to have it available without the need of republishing your function it has to be in the context. The ENV variables available for each function that needs publish every time you modify them are available globally (as you already know).Can you explain why you need to have your importantVar and doSomethingImportantWith outside the handler scope? Maybe I can help you achieve it another way.