Re-add Lambda Functions 'context' parameter when using events
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
When using the new S3, SNS, or SQS decorators, Lambda Functions are no longer declared with the `context` parameter:
```python
@app.on_sns_message(topic='my-demo-topic')
def handle_sns_message(event):
app.log.debug("Received message with subject: %s, message: %s",
event.subject, event.message)
```
As mentioned in #488, using error monitoring tools such as [Sentry](https://github.com/getsentry/sentry) which require the `context` parameter, will result in the deployed application to break during lambda function runtime, with an error like the one below:
```
wrapped() missing 1 required positional argument: 'context': TypeError
Traceback (most recent call last):
File "/var/task/chalice/app.py", line 989, in __call__
return self.func(event_obj)
TypeError: wrapped() missing 1 required positional argument: 'context'
```
I was wondering if it's possible to re-introduce `context` as a parameter. Even if it's really not relevant to the function itself.
Would like some opinions.
Contributor guide
Research direction
Start with the S3, SNS, and SQS decorator handling described in the issue and inspect the handler invocation at chalice/app.py line 989. Trace how wrapped functions receive arguments and verify the change against the reported missing-context runtime error; done means context-dependent handlers execute without that TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100