{"id":16339806,"url":"https://github.com/jkachmar/purescript-lambda-demo","last_synced_at":"2026-02-07T02:02:42.699Z","repository":{"id":93201802,"uuid":"113516017","full_name":"jkachmar/purescript-lambda-demo","owner":"jkachmar","description":"Test out calling Lambda functions directly from PureScript","archived":false,"fork":false,"pushed_at":"2017-12-08T05:39:03.000Z","size":126,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-24T18:14:07.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PureScript","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/jkachmar.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}},"created_at":"2017-12-08T01:20:15.000Z","updated_at":"2020-02-08T16:16:02.000Z","dependencies_parsed_at":"2023-04-07T22:48:03.151Z","dependency_job_id":null,"html_url":"https://github.com/jkachmar/purescript-lambda-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jkachmar/purescript-lambda-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkachmar%2Fpurescript-lambda-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkachmar%2Fpurescript-lambda-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkachmar%2Fpurescript-lambda-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkachmar%2Fpurescript-lambda-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jkachmar","download_url":"https://codeload.github.com/jkachmar/purescript-lambda-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jkachmar%2Fpurescript-lambda-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29184977,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T00:44:15.062Z","status":"online","status_checked_at":"2026-02-07T02:00:07.217Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-10T23:55:12.601Z","updated_at":"2026-02-07T02:02:42.684Z","avatar_url":"https://github.com/jkachmar.png","language":"PureScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## PureScript Lambda Demo\n\nA small demo to show how you can call PureScript from an AWS Lambda Handler.\n\nAll this demo does is accept an AWS Lambda event and attempt to extract a\na `String` from `payload.message`, passing the result off to Lambda's success\ncallback if it's successful or failing with a parse error if it's not.\n\n### Build and Run the Demo\n\n#### Building\nTo generate a Lambda function, clone this repository, install the dependencies \nusing `npm`, and bundle up all the JS with webpack:\n\n    git clone git@github.com:jkachmar/purescript-lambda-demo.git\n    npm install\n    npm run bundle\n\nThis will generate an output file at `dist/index.js` containing the full, \nbundled function.\n\n#### Testing on Lambda\nTo run this demo on AWS Lambda, upload the file from `dist/index.js` like you \nwould any other Lambda function, and test with the following test event payload:\n\n    { \"payload\": { \"message\": \"hello!\" } }\n\n...the handler will succeed:\n\n![Success](images/success.png)\n\nIf a bad payload is supplied, for example with a `Boolean` at `payload.message`:\n\n    { \"payload\" { \"message\": false } }\n\n...the handler will fail:\n\n![Failure](images/failure.png)\n\n#### Testing Locally\nTo run this demo locally, open a `node` REPL in this directory and import the\nbundled output:\n\n    const { handler } = require('./dist/index.js');\n\nThen call `handler` with a good payload, an empty argument, and a callback:\n\n    handler({payload: {message: \"hello!\"}}, {}, (e, a) =\u003e { e ? console.log(e) : console.log(a); })\n\n...and watch it succeed by printing the contents of `payload.message`:\n\n    hello!\n    \nAlternatively, call `handler` with a bad payload, an empty argument, and a \ncallback:\n\n    handler({payload: {message: 0}}, {}, (e, a) =\u003e { e ? console.log(e) : console.log(a); })\n\n...and watch it fail by printing the error and dumping an unhelpful stack trace:\n\n```\nError: (NonEmptyList (NonEmpty (ErrorAtProperty \"payload\" (ErrorAtProperty \"message\" (TypeMismatch \"String\" \"Number\"))) Nil))\n    at Object.exports.error (webpack:///./dist/index.js?:260:12)\n    at eval (webpack:///./dist/index.js?:1520:122)\n    at eval (webpack:///./dist/index.js?:552:22)\n    at repl:1:1\n    at ContextifyScript.Script.runInThisContext (vm.js:50:33)\n    at REPLServer.defaultEval (repl.js:240:29)\n    at bound (domain.js:301:14)\n    at REPLServer.runBound [as eval] (domain.js:314:12)\n    at REPLServer.onLine (repl.js:441:10)\n    at emitOne (events.js:121:20)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkachmar%2Fpurescript-lambda-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjkachmar%2Fpurescript-lambda-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjkachmar%2Fpurescript-lambda-demo/lists"}