INCIDENT RUNBOOK
Fix: Edge Runtime Node Crypto Missing in Remix on AWS ECS
Comprehensive architectural post-mortem and verified configuration patch for remix deployed in aws ecs 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 '/app/node_modules/edge-runtime/dist/index.js'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/node_modules/edge-runtime/dist/index.js:3:18)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)Root Cause Analysis
The error occurs due to a mismatch between the Node.js version used in the development environment and the one used in the AWS ECS container. The `node:crypto` module is not compatible with the edge runtime environment, causing a runtime incompatibility issue. Additionally, the container's resource limits and lifecycle settings may not be properly configured, leading to the module not being initialized correctly.
● Configuration & Code Resolution
diff --git a/docker-compose.yml b/docker-compose.yml
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -10,6 +10,8 @@
environment:
- NODE_ENV=production
+ - NODE_OPTIONS=--experimental-specifier-resolution
+ - EDGE_RUNTIME_NODE_OPTIONS=--enable-source-maps
diff --git a/package.json b/package.json
--- a/package.json
+++ b/package.json
@@ -20,6 +20,8 @@
"scripts": {
"build": "remix build",
+ "postbuild": "cp -r node_modules/edge-runtime/dist/node_modules/crypto node_modules/edge-runtime/dist/"
},
"dependencies": {
"edge-runtime": "^1.2.3"Verification & Build Command
docker-compose exec app node -e "console.log(require('crypto'))" && docker-compose exec app npm run build && docker-compose up -d