arabold/serverless-sentry-plugin

After updating to the latest version of Serverless getting this error when deploying

ldadams opened this issue · 5 comments

Environment variable SENTRY_CAPTURE_ERRORS must contain string

Any thoughts? We have added the config value in YML and also set the env var manually without any luck

Thanks for the report. Serverless has a breaking change that requires environment variables to be an explicit string now. It's kind of stupid considering that JavaScript doesn't even have strict typing, but I guess it's to prevent people from having wrong expectations.

I think this will require an update of the serverless-setry-plugin to fix. I will take a look later this week.

Just took a quick look. I don't see a bug in the plugin itself, but it seems you're setting the environment variables in the serverless.yaml yourself? In that case, simply use quotes like this:

service: my-serverless-project
provider:
  # ...
  environment:
    SENTRY_ENVIRONMENT: ${opt:stage, self:provider.stage} # recommended
    SENTRY_DSN: https://xxxx:yyyy@sentry.io/zzzz # URL provided by Sentry
    SENTRY_CAPTURE_TIMEOUTS: 'false'

It will accept any boolean-like value such as 'true' and 'false', '1' and '0'. Does that solve your problem?

Yes it looks like just wrapping the captureErrors in the below configuration worked.

custom:
  sentry:
    dsn: https://xxx:xxx@sentry.io/xxx
    captureErrors: 'true'

Thanks for the quick support!

FYI, I've just released a new v1.2.0 that doesn't require to explicitly put quotes around captureErrors and other configuration options anymore.