{"id":17330027,"url":"https://github.com/coderbyheart/aws-lambda-esm-with-layer","last_synced_at":"2025-10-28T08:39:17.817Z","repository":{"id":138002334,"uuid":"453254252","full_name":"coderbyheart/aws-lambda-esm-with-layer","owner":"coderbyheart","description":"Demonstrates how to use an AWS Lambda with Node.js using ES modules and dependencies from a layer","archived":false,"fork":false,"pushed_at":"2022-03-17T12:40:37.000Z","size":4,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"saga","last_synced_at":"2025-04-14T17:55:32.338Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coderbyheart.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-01-29T00:10:59.000Z","updated_at":"2023-03-29T04:20:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"2f7b9463-6fb2-4327-b43b-b4099715b8bb","html_url":"https://github.com/coderbyheart/aws-lambda-esm-with-layer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coderbyheart/aws-lambda-esm-with-layer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderbyheart%2Faws-lambda-esm-with-layer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderbyheart%2Faws-lambda-esm-with-layer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderbyheart%2Faws-lambda-esm-with-layer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderbyheart%2Faws-lambda-esm-with-layer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderbyheart","download_url":"https://codeload.github.com/coderbyheart/aws-lambda-esm-with-layer/tar.gz/refs/heads/saga","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderbyheart%2Faws-lambda-esm-with-layer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261107871,"owners_count":23110692,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T14:50:09.232Z","updated_at":"2025-10-28T08:39:17.811Z","avatar_url":"https://github.com/coderbyheart.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e ℹ️ *Note*: [symlinking the node_modules folder](https://github.com/vibe/aws-esm-modules-layer-support) is a simpler solution.\n\n## Instructions\n\n1. Run `make`.\n1. Create a Node JS 14 Lambda Function from `dist/lambda-nodejs14.zip`.\n1. Create a Lambda Layer from `dist/layer.zip`.\n1. Attach layer to the function.\n1. Invoke function. Function will load an ESM from the layer.\n\n---\n\nThe `NODE_PATH` variable is not supported by the ESM loader in Node, as seen [here](https://nodejs.org/docs/latest-v14.x/api/esm.html#esm_no_node_path). In addition, the `NODE_PATH` is not part of resolving import specifiers, which means the layer cannot be reached.\n\nThe [workaround](./user/index.js) would be to use a module from a layer, which would be to expose the dynamic import function from the module that you require.\n\n---\n\n\u003e Using that workaround I cannot `import { s3 } from 'esm_in_layer'` but use explicit, async loading. Adding this boilerplate code to all lambdas adds additional workload which I want to avoid. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderbyheart%2Faws-lambda-esm-with-layer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderbyheart%2Faws-lambda-esm-with-layer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderbyheart%2Faws-lambda-esm-with-layer/lists"}