lumigo-io / lumigo-CLI

Open source CLI tool to help you develop and manage serverless applications.
https://lumigo.io
Apache License 2.0
331 stars 21 forks source link

Cli-tables and Container Image lambda functions #118

Open Daemon-Macklin opened 3 years ago

Daemon-Macklin commented 3 years ago

Hi there,

I was trying to do some cost and performance analysis on a lambda function I have which I built using a container image. However whenever I would run a analyze-lambda-cost on that function, or list-lambda I would get the error message:

TypeError: Cannot read property 'width' of null

Running the function on any other lambda would work perfectly fine, but after digging into the source code and the source code of cli-tables I found that it was getting tripped up by my container image lambda because the runtime value is null like so:

[
  {
    "totalCost": 0,
    "invocationCount": 0,
    "averageCost": 0,
    "region": "region",
    "functionName": "function-name",
    "runtime": null,
    "memorySize": 1024,
    "codeSize": 0,
    "lastModified": "2021-03-16T16:20:28.508+0000",
    "timeout": 30,
    "function-name": {
      "totalCost": 0.02492577,
      "averageCost": 0.001384765,
      "invocationCount": 18
    }
  }
]

Passing this into the table.toString() function causes the type error in cli-tables. When it runs the get_width function.