'Lambda execution failed with status 200 due to customer function error: Missing `pino-pretty` module: `pino-pretty` must be installed separately

I'm trying to deploy AWS Lambda functions and I get the error in the title. I tried installing pino but I still get the same error.

Here is the handler.ts file:

import { middyfy } from "@libs/lambda";
import { formatJSONResponse } from "@libs/apiGateway";
import { connectDb } from "@libs/db";
import HttpException from "@libs/errors/HttpException";
import { getPropertiesService } from "./service";

let cachedDb;

const getAllProperties = async () => {
    cachedDb = await connectDb(cachedDb);
    
    try {
        const properties = await getPropertiesService();
        return formatJSONResponse(200, {
            "statusCode": 200,
            message: "List of properties:",
            "headers": { "Access-Control-Allow-Origin": "*",
            "Content-Type": "application/json"},
            body: JSON.stringify(properties),
            "isBase64Encoded": false,
        });
        
    } catch (error) {
        if (error instanceof HttpException) return error.toJSON();
        return formatJSONResponse(500, { message: error.message });
    }
};

export const main = middyfy(getAllProperties);

The index.ts file:

import { handlerPath } from "@libs/handlerResolver";
const getAllProperties = {
  handler: `${handlerPath(__dirname)}/handler.main`,
  events: [
    {
      http: {
        method: "get",
        path: "properties",
      },
    },
  ],
};

export default getAllProperties;


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source