INCIDENT RUNBOOK
Fix: Edge Runtime Node Crypto Missing in Remix on AWS Lambda
Comprehensive architectural post-mortem and verified configuration patch for remix deployed in aws lambda production environments.
Automated Remediation ProtocolUpdated for 2026 Production
Facing edge-runtime-node-crypto-missing in CI/CD or runtime containers?
Review the verified configuration patches below. To automate incident triage and fine-tune your own internal agents, check out our production AI training datasets.
● Observed Terminal Error / Stack Trace
Error: Cannot find module 'crypto' from /var/task/node_modules/edge-runtime/dist/index.js
at resolveModule (/var/task/node_modules/edge-runtime/dist/index.js:23:23)
at Module._resolveFilename (/var/task/node_modules/edge-runtime/dist/index.js:35:15)
at Module._load (/var/task/node_modules/edge-runtime/dist/index.js:41:21)
at Module.require (/var/task/node_modules/edge-runtime/dist/index.js:49:19)
at require (/var/task/node_modules/edge-runtime/dist/index.js:53:16)Root Cause Analysis
The error occurs due to a runtime incompatibility between the Node.js version used by AWS Lambda and the Edge Runtime required by Remix. Specifically, the Node.js version used by AWS Lambda does not include the 'crypto' module, which is a dependency of the Edge Runtime. This incompatibility arises from the fact that the 'crypto' module is not included in the AWS Lambda Node.js runtime by default, and the Edge Runtime, which is designed to work with modern web frameworks like Remix, expects this module to be present.
● Configuration & Code Resolution
To resolve this issue, you need to add the 'crypto' module as a dependency in your Remix project and configure AWS Lambda to include this module in the runtime. You can achieve this by modifying your `remix.config.js` file to include the following configuration:
module.exports = {
//... other configurations...
async edgeRuntime(pieces) {
pieces.runtime = 'nodejs16.x';
pieces.dependencies = [...pieces.dependencies, 'crypto'];
return pieces;
}
};
Additionally, you need to update your `aws-lambda` configuration to include the 'crypto' module in the runtime. You can do this by adding the following configuration to your `aws-lambda` configuration file:
{
"runtime": "nodejs16.x",
"handler": "index.handler",
"dependencies": [
"crypto"
]
}Verification & Build Command
To verify the resolution, run the following command: `npx remix build && npx remix deploy aws-lambda --verbose`. This command will build your Remix project, deploy it to AWS Lambda, and display detailed output to help you verify that the 'crypto' module is now included in the runtime.