Got an error handlerNotFound when invoking lambda function

55 Views Asked by At

I've been learning aws lambda, so I decided to work with AWS SAM. I've configured everything, but I got this error for an unknown reason for me as fucntion createUser located in app.ts

Here is how my .yaml look

Resources:
  CreateUser:
    Type: AWS::Serverless::Function 
    Properties:
      CodeUri: src/
      Handler: app.createUser
      Runtime: nodejs18.x
      Architectures:
        - x86_64
      Events:
        CreateUser:
          Type: Api 
          Properties:
            Path: /createUser
            Method: post
    Metadata: 
      BuildMethod: esbuild
      BuildProperties:
        Minify: true
        Target: es2020
        Sourcemap: true
        EntryPoints:
          - app.ts

I've double checked the names of the function, I've checked where app.ts is stored, but I still got this error

!!!Edit 1

createUser function

export const createUser = async (event: any, context: any, callback: any) => {
    const { input } = event.arguments;
    console.log(input);
    try {
        return await UserService.createUser(input);
    } catch (error) {
        callback(error);
    }
};
0

There are 0 best solutions below