{"id":16014906,"url":"https://github.com/thheller/lambda-cljs","last_synced_at":"2026-02-20T22:01:56.897Z","repository":{"id":140237016,"uuid":"606374632","full_name":"thheller/lambda-cljs","owner":"thheller","description":"AWS Lambda via shadow-cljs","archived":false,"fork":false,"pushed_at":"2023-02-25T10:14:25.000Z","size":21,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-02T11:51:28.065Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Clojure","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/thheller.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":"2023-02-25T09:47:31.000Z","updated_at":"2024-12-08T16:14:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"6e29fdfd-0b91-4659-a322-bae1877616b4","html_url":"https://github.com/thheller/lambda-cljs","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"45c754ebd7a6aa5f62ab7205ba45c06632c38bcd"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thheller/lambda-cljs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thheller%2Flambda-cljs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thheller%2Flambda-cljs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thheller%2Flambda-cljs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thheller%2Flambda-cljs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thheller","download_url":"https://codeload.github.com/thheller/lambda-cljs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thheller%2Flambda-cljs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29666425,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T19:49:36.704Z","status":"ssl_error","status_checked_at":"2026-02-20T19:44:05.372Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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-08T15:05:29.359Z","updated_at":"2026-02-20T22:01:56.876Z","avatar_url":"https://github.com/thheller.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS Lambda via CLJS\n\nAnswering [this post](https://clojureverse.org/t/lambda-function-in-clojurescript-how-where/9791/1) by showing an AWS Lambda example.\n\nClone repo and run\n```\nsh build.sh\n```\n\nThis creates a `dist/lambda.zip`.\n\nDeploy `dist/lambda.zip` to AWS. I'm sure you can do this via the command line somehow. I just created the AWS Lambda in their web interface and uploaded it manually for testing. I know next to nothing about AWS, just want to demonstrate the CLJS bits.\n\nFor this example I had to bump the default runtime timeout. 3sec didn't seem enough. The `@mozilla/readability` part seems to take about 5sec to run. 10sec timeout should be plenty. Don't know why it is so slow, it isn't in the CLJS bits.\n\nLet's go over what `build.sh` does. You can use anything to perform these steps, but this seemed easiest to explain.\n\n```\nrm -rf dist\nmkdir dist\n```\nCreate an empty `dist` directory just so we don't copy files we don't need.\n\n```\nnpx shadow-cljs release lambda --config-merge '{:output-to \"dist/index.js\"}'\n```\nTell shadow-cljs to make a release build for the `:lambda` build. Using config-merge here, so it outputs the file directly to the `dist` folder. Could do this via the build config directly too.\n\n```\ncp package.json package-lock.json dist\ncd dist\nnpm install --omit=dev\n```\n\nEnsure that all dependencies we may need are installed in the `dist` directory itself. the `--omit=dev` will not install `devDependencies`. Meaning that `shadow-cljs` itself won't be in the `dist` dir since it is not required. Makes the zip significantly smaller.\n\n```\nrm package-lock.json\nzip -r lambda.zip .\n```\n\nFinally, create the zip file by zipping up the entire `dist` folder. You may also delete any additional files you do not need. So, just deleting the lock file as an example. It won't hurt anything if you keep it.\n\nThe build result here is a `2.5mb` zip file, which is mostly due to `node_modules` files. The CLJS output itself is 22kb zipped, 98kb unzipped.\n\nDeployment via s3 buckets is also an option, but I'll leave you to figure out AWS specifics on your own.\n\n## Development\n\nFor local development you can run `npx shadow-cljs watch lamba` or `npx shadow-cljs server` and using the http://localhost:9630/builds/lambda UI to start/stop the `watch`.\n\nExecuting `node test.js` runs the local output. Of course that is going to get limited quick. I don't know what options AWS provides for actually running lambda locally. You'll probably want to adjust the `event` parameter in `test.js` at some point. You won't get a `null` in a real lambda after all.\n\nIf the `server` is running the `build.sh` will also be significantly faster, since it doesn't need to start a new CLJS instance.\n\nIf you want a REPL use `npx shadow-cljs node-repl`, as the `:lambda` build has it disabled. Didn't want to have the node process linger after calling the handler via `test.js`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthheller%2Flambda-cljs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthheller%2Flambda-cljs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthheller%2Flambda-cljs/lists"}