Skip to content

Commit 24ae310

Browse files
committed
docs(lambda): address PR review on AWS Lambda deployment guide
One blocker + two important items from Vai's review: - The BROWSER_GPU_NOT_SOFTWARE troubleshooting entry pointed adopters at a non-existent `data-gpu-mode` composition attribute. Replaced with the actual root cause (Chrome launch flags + @sparticuz/chromium libs in the handler ZIP) and the actual remediation: rebuild + redeploy via `lambda deploy` (which always rebuilds the ZIP). The composition-attribute story would have sent users editing the wrong file entirely. - Added a `sites create` subsection under Path 1 so adopters running tight inner loops know how to reuse a project upload across many renders instead of re-tarring + re-uploading on each call. The CLI surface was first-class but the doc had been silent. - Added a Warning callout under Path 2 explaining that the SAM template's own ReservedConcurrency default is `-1` (unreserved) — a reader simplifying the Path 2 example by dropping the --parameter-overrides flag would silently switch to unreserved concurrency and pay the runaway-Map cost. The warning mirrors the cost-shape callout earlier in the page.
1 parent 3d5b5e0 commit 24ae310

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

‎docs/deploy/aws-lambda.mdx‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,20 @@ The `--wait` flag blocks and streams per-chunk progress + accrued cost; drop it
7373

7474
See the [CLI reference](/packages/cli#hyperframes-lambda) for full flag documentation.
7575

76+
#### Pre-staging a project with `sites create`
77+
78+
Re-rendering the same project tree on every `lambda render` call re-tars and re-uploads it each time. For tight inner loops (CI smoke jobs, prompt iteration in a demo flow), pre-stage the project once and reuse the upload:
79+
80+
```bash
81+
hyperframes lambda sites create ./my-project
82+
# → Site ID: a1b2c3d4e5f6g7h8 (content-addressed)
83+
84+
hyperframes lambda render ./my-project --site-id=a1b2c3d4e5f6g7h8 \
85+
--width 1920 --height 1080 --wait
86+
```
87+
88+
The `siteId` is content-addressed via a SHA-256 of the project tree; re-running `sites create` on an unchanged tree skips the upload via a `HeadObject` short-circuit. Pass the same `--site-id` to as many `lambda render` calls as you like — they all reuse the one S3 PUT.
89+
7690
### Path 2 — Direct SAM deploy
7791

7892
If you want to read the CloudFormation before you deploy, or you need to customise the topology (extra alarms, SNS subscribers, KMS keys, …), invoke SAM directly against the template at `examples/aws-lambda/template.yaml`:
@@ -96,6 +110,10 @@ The template emits three CloudFormation outputs you'll need to invoke renders:
96110
- `RenderStateMachineArn` — the Step Functions standard workflow that orchestrates Plan → Map → Assemble.
97111
- `RenderFunctionArn` — the single Lambda function the state machine dispatches against.
98112

113+
<Warning>
114+
The SAM template's own default for `ReservedConcurrency` is `-1` (unreserved, account-default). The Path 1 CLI overrides it to `8` to keep first-time spend bounded; if you drop `ReservedConcurrency` from `--parameter-overrides` here, you get the unreserved default. Set it explicitly unless you've already sized your typical render's fan-out.
115+
</Warning>
116+
99117
### Path 3 — CDK construct
100118

101119
For users already running CDK, the `@hyperframes/aws-lambda` package exports a `HyperframesRenderStack` L2 construct that emits the same topology as the SAM template:
@@ -170,7 +188,14 @@ Step Functions invoked a `renderChunk` with a plan hash that didn't match the pl
170188

171189
### `Lambda function failed: BROWSER_GPU_NOT_SOFTWARE`
172190

173-
The compiled composition reads `data-gpu-mode="hardware"` (or similar). Distributed renders require `gpu-mode="software"` — hardware GL is non-deterministic across chunk boundaries. Change the composition's `data-gpu-mode` or omit it (the default is software).
191+
The handler launched Chromium but the runtime probe found a non-SwiftShader GL backend. Hardware GL is non-deterministic across chunk boundaries, so distributed renders refuse it at the runtime-image / launch-flags layer (not at the composition layer). Rebuild the handler ZIP and redeploy:
192+
193+
```bash
194+
bun run --cwd packages/aws-lambda build:zip
195+
hyperframes lambda deploy --stack-name=<your-stack>
196+
```
197+
198+
The build pipeline pins `@sparticuz/chromium` + the Chrome flags (`--use-gl=swiftshader --use-angle=swiftshader`) so a fresh deploy almost always resolves this. If it persists, your stack's Lambda function is pointing at a stale handler ZIP from a previous deploy — `lambda deploy` always rebuilds, so re-running unsticks it.
174199

175200
### Render seems stuck at `RUNNING`
176201

0 commit comments

Comments
 (0)