{"id":19042507,"url":"https://github.com/serverless/serverless-open-runtime","last_synced_at":"2025-04-23T22:28:46.639Z","repository":{"id":43476532,"uuid":"158459686","full_name":"serverless/serverless-open-runtime","owner":"serverless","description":"WIP - An extensible, community-driven, open-runtime for serverless compute","archived":false,"fork":false,"pushed_at":"2019-01-09T01:40:58.000Z","size":1210,"stargazers_count":69,"open_issues_count":1,"forks_count":6,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-04-18T07:51:33.863Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.serverless.com","language":"Go","has_issues":true,"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/serverless.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}},"created_at":"2018-11-20T22:32:14.000Z","updated_at":"2025-01-07T01:57:03.000Z","dependencies_parsed_at":"2022-07-09T22:46:18.790Z","dependency_job_id":null,"html_url":"https://github.com/serverless/serverless-open-runtime","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless%2Fserverless-open-runtime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless%2Fserverless-open-runtime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless%2Fserverless-open-runtime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serverless%2Fserverless-open-runtime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serverless","download_url":"https://codeload.github.com/serverless/serverless-open-runtime/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250525764,"owners_count":21445073,"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-11-08T22:38:03.533Z","updated_at":"2025-04-23T22:28:46.624Z","avatar_url":"https://github.com/serverless.png","language":"Go","readme":"# The Serverless Open Runtime for AWS Lambda\n\nThis uses AWS's Runtime API for Lambda to implement a universal runtime.\n\nWhen done it will feature (exact list TBD):\n * [CloudEvent](https://cloudevents.io/) based function signature\n * [Middlewares](#middlewares)\n * [Language Agnostic](#language-agnostic)\n * Graceful timeout handling - [poc branch](https://github.com/serverless/open-runtime-poc/tree/timeout-test)\n * more!\n\n## Try it out\n\n\n```shell\nnpm i -g serverless # make sure you have serverless framework verison 1.34.0 or greater\nmake\nsls deploy\ncd example\nsls deploy\nsls invoke -f hello\n```\n\n## NodeJS debugging!\nThe open runtime implementation Node JS supports remote debugging. To use it:\n1. ensure you have a high timeout on your lambda (or else it'll be killed while debugging)\n2. on a publicly accessible server, install `socat` and run:\n   ```\n   socat -v TCP-LISTEN:9999,reuseaddr,fork TCP-LISTEN:4444,reuseaddr\n   ```\n3. invoke your lambda with the `_debugProxy` key in the event set to `1.1.1.1:4444` but changing\n   `1.1.1.1` to the IP address of the server you stared `socat` on:\n   ```\n   sls invoke -f hello -d '{\"_debugProxy\": \"1.1.1.1:4444\"}'\n   ```\n4. open the chrome debugger to [`chrome-devtools://devtools/bundled/inspector.html?ws=1.1.1.1:4444`](chrome-devtools://devtools/bundled/inspector.html?ws=1.1.1.1:4444) (again changing 1.1.1.1 to your server's IP)\n\n## Middlewares\nThe current plan for middlewares allows them to be written in any language\nby invoking the middleware as an executable with the event or response passed in via\nstandard in \u0026 out. The first argument specifies the hook that is being invoked.\n\nMiddlewares are best stored in layers and must be stored in the `middlewares` directory\n(IE: `/opt/middlewares/` inside the lambda execution environment)\n\nTo specify the handler middlewares your function should use, set the `SLSMIDDLEWARES` environment\nvariable to a comma delimited list of middlewares by the filename of the middleware executable.\n*Note:* it's possible to make a layer imply a middleware by searching for the file of the same name\nas the layer, but it requires an API call to get the lambda's configuration at runtime startup\n(slower cold start) and might be more AWS specific than is desireable.\n\n### Middleware specifics example\nIf you set `SLSMIDDLEWARES=test` when an event, say `{\"foo\": \"bar\"}` is recieved, the equivalent\nfollowing will be executed:\n```\necho '{\"foo\": \"bar\"}' | /opt/middlewares/test before\n```\nand the STDOUT of the that execution will be read and replace the original event.\n\nThen, when the user handler returns a response, say: `{\"body\": \"hello\"}` the middleware will\nsimilarlly be invoked as the equivalent of:\n```\necho '{\"body\": \"hello\"}' | /opt/middlewares/test after\n```\nand the STDOUT will replace the original response.\n\n### Potential downsides of this middleware architecture\nHow will can this be leveraged to implement APM style monitoring that usually\nmonkeypatches language constructs.\n\n## Language Agnostic\nThe current Proof of Concept is implemented in NodeJS 10, but the final open runtime\nwill likely be implemented in Go. A language runtime will be specified to the open\nruntime to support specific languages.\n\nThis allows the open runtime to have a single implementation  while supporting many languages.\nA language-runtime will be started when the open-runtime starts and communicate with it via STDIN \u0026\nSTDOUT as it receives events. There is currently an implementation of this for nodejs 10\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless%2Fserverless-open-runtime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserverless%2Fserverless-open-runtime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserverless%2Fserverless-open-runtime/lists"}