Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on_sns_message results in error when triggered by CloudWatch Log Event #1801

Open
spirittq opened this issue Sep 8, 2021 · 0 comments
Open

Comments

@spirittq
Copy link

spirittq commented Sep 8, 2021

I have created an SNS topic that is subscribed to a lambda function and is triggered when another lambda function errors out (with [ERROR] filter). However, I am trying to test it after chalice is deployed and always receive an error.

[ERROR] KeyError: 'Records'
Traceback (most recent call last):
  File "/var/task/chalice/app.py", line 1564, in __call__
    event_obj = self.event_class(event, context)
  File "/var/task/chalice/app.py", line 1771, in __init__
    self._extract_attributes(event_dict)
  File "/var/task/chalice/app.py", line 1833, in _extract_attributes
    first_record = event_dict['Records'][0]

Which, as I understand, happens in decorator. My actual code doesn't even start:

@app.on_sns_message(topic='error_logger')
def cloudwatch_error(event):
    print(event.subject)
    print(event.message)

Not sure if I'm doing something wrong or not, but wanted to share this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant