Skip to content

Commit

Permalink
doc: update
Browse files Browse the repository at this point in the history
  • Loading branch information
aheissenberger committed Sep 27, 2024
1 parent ffe84f0 commit 4619f1e
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@ npm run build -- --with-aws-lambda
```

The handler entrypoint is `dist/serve-asw-lambda.js`: see [Hono AWS Lambda Deploy Docs](https://hono.dev/getting-started/aws-lambda#_3-deploy).
Streaming can be activated by setting environment variable `DEPLOY_AWS_LAMBDA_STREAMING=true npm run build -- --with-aws-lambda`

## Community

Expand Down
65 changes: 63 additions & 2 deletions docs/builder/aws-lambda.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ The entry handler for the Lambda is `dist/serve-aws-lambda.handler`.

> Folder which require directly access - eg. `fs.readFile("./private/data.json")` needs to be manual added to the deployment configuration.
> **activate Streaming support:** `DEPLOY_AWS_LAMBDA_STREAMING=true pnpm build --with-aws-lambda`
## [Serverless Framework](https://www.serverless.com)

### Installation
Expand Down Expand Up @@ -67,7 +69,7 @@ This configuration will include all files from the `./private` directory in the
### Deploy

```sh
pnpm dlx serverless deploy
pnpx serverless deploy
```

Output:
Expand All @@ -92,7 +94,7 @@ Initialize your project with the `cdk` CLI

```sh
mkdir cdk && cd "$_"
pnpm dlx cdk init app -l typescript --generate-only
pnpmx cdk init app -l typescript --generate-only
cd ..
cp cdk/cdk.json .
```
Expand Down Expand Up @@ -242,3 +244,62 @@ pnpm cdk deploy WakuStack
```

For more configuration options and how to use a custom domain visit the AWS CDK [documentation](https://docs.aws.amazon.com/cdk/v2/guide/home.html)

## sst.dev V3

This example requires a build with activated streaming.

### Setup

1. add `pnpd sst@latest init`

### configuration

use this as an example to run WAKU as Lamda Function:

sst.config.ts
```ts
/// <reference path="./.sst/platform/config.d.ts" />
export default $config({
app(input) {
return {
name: "waku03demo",
removal: input?.stage === "production" ? "retain" : "remove",
home: "aws",
};
},
async run() {
const WakuDemoApp = new sst.aws.Function("WakuDemoApp", {
url: true,
streaming: true,
//timeout: "15 minutes",
handler: "dist/serve-aws-lambda.handler",
bundle: "bundle", // disable bundling with esbuild
copyFiles: [
{
from: "dist"
},
{
from: "private"
}
],
environment: {
NODE_ENV: "production",
},
});
return {
api: WakuDemoApp.url,
};
},
});
```

### deploy

```sh
ssh deploy
```

[sst.dev documentation](https://sst.dev/docs)

0 comments on commit 4619f1e

Please sign in to comment.