How to Use Source Maps in TypeScript Lambda Functions (with Benchmarks)

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • Scout APM - Less time debugging, more time building
  • SonarQube - Static code analysis for 29 languages.
  • node-source-map-support

    Adds source map support to node.js (for stack traces)

    If we needed to enable Source Maps in a runtime that doesn't support the native version, we could always use Source Map Support.

  • serverless-graphql

    Serverless GraphQL Examples for AWS AppSync and Apollo

    The Serverless Framework is known for its plugin system. serverless-esbuild brings bundling and all the options we need to support Source Maps in TypeScript into the sls package and sls deploy commands.

  • Appwrite

    Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!

  • lambda-sourcemaps

    All example code is available on GitHub.

  • serverless-stack

    💥 SST makes it easy to build serverless apps. Set breakpoints and test your functions locally. https://serverless-stack.com

    Serverless Stack is a very cool value add that builds on top of AWS CDK delivering an awesome developer experience and dashboard. Unfortunately SST's own version of NodejsFunction, Function, doesn't support Source Maps or allow the passing of custom config options to esbuild. Hopefully this can be supported soon.

  • aws-lambda-builders

    Python library to compile, build & package AWS Lambda functions for several runtimes & framework

    SAM support for TypeScript has been lagging for some time, but a pull request was just merged that should change that. It looks like we'll be able to add an aws_sam key in the package.json file to enable building within the SAM engine as part of sam build. Although this PR has been merged to aws-lambda-builders, the engine behind sam build, it will still need to be added to aws-sam-cli and released (to much fanfare, one expects) before it can be used with SAM.

  • esbuild

    An extremely fast JavaScript and CSS bundler and minifier

    Emitting Source Maps is very easy with esbuild. We simply set the boolean property in our configuration. Now when we run the build, we'll get an index.js.map file as well as our index.js. This file must be uploaded to the Lambda service. We'll see how to do that with AWS CDK, AWS SAM and the Serverless Framework a bit later in this article.

  • aws-sam-cli

    CLI tool to build, test, debug, and deploy Serverless applications using AWS SAM

    SAM support for TypeScript has been lagging for some time, but a pull request was just merged that should change that. It looks like we'll be able to add an aws_sam key in the package.json file to enable building within the SAM engine as part of sam build. Although this PR has been merged to aws-lambda-builders, the engine behind sam build, it will still need to be added to aws-sam-cli and released (to much fanfare, one expects) before it can be used with SAM.

  • Scout APM

    Less time debugging, more time building. Scout APM allows you to find and fix performance issues with no hassle. Now with error monitoring and external services monitoring, Scout is a developer's best friend when it comes to application development.

  • architect

    The simplest, most powerful way to build serverless applications

    Alternately, use Architect. Architect is a 3rd party developer experience that builds on top of AWS SAM. Architect includes a TypeScript plugin.

  • plugin-typescript

    TypeScript custom runtime + workflows integration for Architect

    Alternately, use Architect. Architect is a 3rd party developer experience that builds on top of AWS SAM. Architect includes a TypeScript plugin.

  • autocannon

    fast HTTP/1.1 benchmarking tool written in Node.js

    I used autocannon to test the function at 100 concurrent executions for 30 seconds. I also used Lambda Power Tuning to find the ideal memory configuration, which proved to be 512MB. All the results are available.

  • aws-lambda-power-tuning

    AWS Lambda Power Tuning is an open-source tool that can help you visualize and fine-tune the memory/power configuration of Lambda functions. It runs in your own AWS account - powered by AWS Step Functions - and it supports three optimization strategies: cost, speed, and balanced.

    I used autocannon to test the function at 100 concurrent executions for 30 seconds. I also used Lambda Power Tuning to find the ideal memory configuration, which proved to be 512MB. All the results are available.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts