Search code examples
amazon-web-servicesvariablesaws-lambda

AWS SAM - global variables not exists under process.env


im having some issues with global variables. I have this in my template.yaml

Globals:
  Function:
    Environment:
      Variables:
        DEV: true

Then I access those variables in code just with

process.env.DEV

But the problem is that variable does not exist. Only ACCESS_AWS_TOKEN is there. Why is that?


Solution

  • Ok.. everything is a string so... use proper condition.

    One of the solutions:

    process.env.DEV.toLowerCase() === 'true'