Lambdas are broken after a new deployment to a serverless application breaking production functionality

0

We deployed a new version of a serverless (python) application yesterday. All the CloudFormation events have it looking like a successful deployment.

The error is that every lambda gets the Handler 'handler' missing on module 'routes/file_name' We have not made any changes to the structure of our code, nor any changes at all from the AWS console. The changes we made are to use a newer version of Google Ads library, and also deployed from a new machine that required an updated version of serverless and node packages (plus whatever changed in their dependencies.)

$node --version
v16.19.1
$serverless --version
Running "serverless" from node_modules
1.30.1

I tried

  • Rolling back one of the lambdas by specifying an older version int he API Gateway function that acts as a pass-through to the lambda.
  • Deploying a previous version of our code, which I believe is exactly what was already being used by the lambda
  • Creating an alias of an old version of the lambda, but couldn't figure out what to do with it.

I also double-checked the CloudWatch logs and verified that things were working correctly before the new deplioyment.

And finally, we deployed another app with a single lamda that gets its input from an SQS queue, with the same (broken) result.

This is causing a production outage of functionality that is important to our customers.

asked 2 years ago452 views
1 Answer
0

the error "Handler 'handler' missing on module 'routes/file_name'" indicates that AWS Lambda cannot find the specified handler in the given module.

to resolve the "Handler 'handler' missing on module 'routes/file_name'" error, follow these steps:

  1. Check your serverless.yml file to ensure the handler is specified correctly (e.g., routes/yourFile.handler).
  2. Verify the handler functions are correctly exported in their respective files (e.g., routes/file_name.py).
  3. Inspect the generated package in the .serverless directory to ensure the file structure and required files are present.
  4. Try creating a new virtual environment, reinstall your dependencies, and redeploy your serverless application.
  5. Roll back to the previous working versions of the Serverless Framework, Node.js, or other dependencies, and redeploy.

These steps should help you identify and fix the issue causing your Lambda functions to break in production.

profile picture
EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions