# cs5260 consumer This project uses the [Bun TS Runtime](https://bun.sh/) To install dependencies: ```bash bun install ``` To run: ```bash bun run index.ts ``` With the arguments: ``` --sourcebucket: the bucket to poll for widget requests --storagebucket: the bucket to store and modify widgets according to received requests --storagetable: the DDB table to store and modify widgets according to received requests --storageprefix: the prefix to store S3 objects in (only required if storagebucket is given) ``` And either one of storagebucket or storagetable must be given. Unit tests: ```bash bun test ``` ## Lambda Handler There is a current bug in bun 1.0.8, the latest version: [https://github.com/oven-sh/bun/issues/7028], which is not present in v1.0.7 and earlier. Thus, I recommend using `asdf` to manage the bun version in this part of the project. To deploy the lambda handler, first build and publish the Bun runtime layer on your AWS account: ```bash bun run build-layer --arch aarch64 \ --release 1.0.7 --output ./bun-lambda-layer.zip bun run publish-layer --region us-east-1 \ --arch aarch64 --release 1.0.7 \ --output ./bun-lambda-layer.zip ``` Then, create a Lambda function with runtime "custom bootstrap on amazon linux 2" and name "widget-api-handler", and handler to "handler.fetch" (found in "Code"). In the Lambda console then attach the layer "bun".