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 backend cloud platform
  • InfluxDB - Collect and Analyze Billions of Data Points in Real Time
  • Sonar - Write Clean JavaScript Code. Always.
  • Onboard AI - Learn any GitHub repo in 59 seconds
  • Revelo Payroll - Free Global Payroll designed for tech teams
  • 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 backend cloud platform. The open-source backend cloud platform for developing Web, Mobile, and Flutter applications. You can set up your backend faster with real-time APIs for authentication, databases, file storage, cloud functions, and much more!

  • lambda-sourcemaps

    All example code is available on GitHub.

  • sst

    Build modern full-stack applications on AWS

    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 bundler for the web

    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.

  • InfluxDB

    Collect and Analyze Billions of Data Points in Real Time. Manage all types of time series data in a single, purpose-built database. Run at any scale in any environment in the cloud, on-premises, or at the edge.

  • architect

    The simplest, most powerful way to build a functional web app (fwa)

    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 + workflow 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