# Runtime.HandlerNotFound: index.handler is undefined or not exported

**Code:** `Runtime.HandlerNotFound` · **Category:** AWS · **Seen on:** AWS

Lambda loaded the file but couldn’t find the function named in the handler setting.

## Meaning

The handler setting is file.exportedFunction (Node) or module.function (Python). Renamed functions, default exports, TypeScript compiled to another folder, or ESM files (.mjs) referenced as .js cause it.

## Common causes

- Handler setting doesn’t match file or function name
- Function not exported (Node: exports.handler / export const handler)
- Compiled output in dist/ but handler points at the root
- Default export instead of named export

## Quick fix

1. Set the handler to <file>.<export> exactly
2. Export the function with the expected name
3. Point the handler at the compiled path (dist/index.handler)

## Detailed fix by platform

### Node.js

1. 

```javascript
export const handler = async (event) => {
  return { statusCode: 200, body: "ok" };
};   // handler setting: index.handler
```


## How to diagnose

1. **Setting** — Runtime settings → Handler
2. **Export** — Name exported by the file
3. **Path** — File location in the zip

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/aws/lambda-runtime-handlernotfound)
