HandlerNotFound Error After Moving Lambda Function to Module in Chalice
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
I have a Lambda function deployed with Chalice that is triggered by an SQS queue event. After refactoring my code to move the function from the main app.py file to a module and registering the module via a blueprint, I started receiving the following error:
```
[ERROR] Runtime.HandlerNotFound: Handler 'any_handler' missing on module 'app'
Traceback (most recent call last):
```
api.py
```
from chalice import Blueprint
api = Blueprint(__name__)
@api.on_sqs_message(
queue='queue_name',
batch_size=1
)
def any_handler(event):
# Function logic here
```
app.py:
```
from chalice import Chalice
from chalicelib.api import api, handle_http_errors
app = Chalice(app_name='app_name')
app.api.binary_types = ['application/x-protobuf']
app.register_blueprint(api)
app.register_middleware(handle_http_errors, 'http')
```
Chalice version: 1.31.0
Contributor guide
Research direction
Start with the deployment setup shown in app.py and chalicelib/api.py, using Chalice 1.31.0 and the SQS-triggered any_handler. Reproduce the deployment and inspect how registering the blueprint affects the Lambda handler entry point. Done means the deployed SQS function invokes any_handler without Runtime.HandlerNotFound.
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
- 35/100