Closed jbenguira closed 3 weeks ago
Using Edge.js in AWS Lambda is either hard or impossible. There are two issues. First, like all native modules, Edge must first be compiled for the very platform that AWS Lambda uses to run code. This means you must run the npm install
on the same OS as AWS Lambda uses at runtime. Second, on *nix systems Edge has a dependency on Mono, which must be separately installed on the host. As far as I know Lambda does not support well (or at all) such scenario.
I'd recommend you check out https://webtask.io, which allows you to execute Node.js code in the cloud in an isolated manner and with low latency, and comes with 600+ pre-installed Node.js modules, including Edge.js. You can run Node.js or C# code with a simple HTTP request:
curl https://webtask.it.auth0.com/api/run/wt-home-container-8 \
-H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6IjIifQ.eyJqdGkiOiIxZjYwZjA5NGM3MGM0NDgxYmQ4ODgyZjQzM2FmMjZmYSIsImlhdCI6MTQzMDI2NTUyNywiZHIiOjEsImNhIjpbXSwiZGQiOjAsInRlbiI6Ii9ed3QtaG9tZS1jb250YWluZXItWzAtOV1bMC05XT8kLyIsImx0cyI6MTAwMCwibHRoIjoxMjUwMH0.ErZ7KXzbQ7mm_BB4xx1-mwF2_aZUvus7283khvhMgLY' \
--data-binary 'module.exports = function (cb) { require("edge").func("async (x) => { return \"Hello from C#\"; }")(null, cb); }'
Hello
is it possible to use edge with AWS Lambda?
i just tried and getting this output from AWS LAMBDA:
{ "errorMessage": "The edge native module is not available at /var/task/node_modules/edge/build/Release/edge.node. You can use EDGE_NATIVE environment variable to provide alternate location of edge.node. If you need to build edge.node, follow build instructions for your platform at https://github.com/tjanczuk/edge", "errorType": "Error", "stackTrace": [ "Object. (/var/task/node_modules/edge/lib/edge.js:35:11)",
"Module._compile (module.js:456:26)",
"Object.Module._extensions..js (module.js:474:10)",
"Module.load (module.js:356:32)",
"Function.Module._load (module.js:312:12)",
"Module.require (module.js:364:17)",
"require (module.js:380:17)",
"Object. (/var/task/app.js:1:74)",
"Module._compile (module.js:456:26)",
"Object.Module._extensions..js (module.js:474:10)"
]
}