Home > Blockchain >  AWS SAM - global variables not exists under process.env
AWS SAM - global variables not exists under process.env

Time:08-06

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?

CodePudding user response:

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

One of the solutions:

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