epsagon/serverless-plugin-epsagon

Config value to disable Epsagon function at service level is not used

Closed this issue ยท 5 comments

Setting config value for disable = false at the service level is not respected.
In src/index.js line 99 if (this.config().disable)

This I guess is checking just for the existing of the config attribute and not checking the actual value to equal true so it cannot be used to control whether epsagon is disable or not. We are relying on this config value so we can disable epsagon for specific environment

Perhaps it can be changed to:
if (this.config().disable && this.config().disable === 'true')?

Cheers, Ky

Hi @ky-cheng - I tried now with the following configuration:

custom:
  epsagon:
    token: your-token-here
    appName: optional-application-name
    disable: false

And I got the functions wrapped successfully.
Can you please give me an input that fails? Please note that the input should be a boolean type and not string.

Thanks

We can however change it to:
if (this.config().disable && this.config().disable.toString().toLowerCase() === 'true')
Just to support both boolean and string inputs.

@ranrib thanks for the quick fix! So I have verified that injecting value are always injected as string hence the boolean check does not work.

Eg. disable: ${opt:disableEpsagon} injecting via cli parameters or
disable: ${ssm:/epsagon/${opt:env}/disable} injecting via aws system manager parameter store both are string value

I got around the issue by doing the following:

  disableEpsagon:
    local: true
    other: false
  epsagon:
    token: ${ssm:/epsagon/token~true}
    appName: ${opt:env} Inquisitive
    disable: ${self:custom.disableEpsagon.${opt:env}, self:custom.disableEpsagon.other}

which sets disable to true or false base on env

๐ŸŽ‰ This issue has been resolved in version 1.5.4 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€