# AWS Lambda Chromium Binary Size Limit

Getting "Unzipped size must be smaller than 262144000 bytes" when deploying
Puppeteer or Playwright to Lambda usually means Chromium pushed the package
over the 250 MB unzipped deployment limit.

Plain text for agents: https://riddledc.com/guides/lambda-chromium-size-limit/markdown.md

## The Error

```text
Unzipped size must be smaller than 262144000 bytes
```

Chromium alone can be larger than Lambda's unzipped deployment limit. Even
stripped Chromium builds, Puppeteer, Playwright, and application code leave
little room before deployment fails.

## Traditional "Solutions"

Lambda Layers split Chromium into a separate artifact, but layers still count
toward the deployment size. They also add version management and still leave
the cold start problem.

`@sparticuz/chromium` reduces binary size, but teams still need to match
Chromium and browser-library versions and accept missing rendering features.

Container Images raise the size ceiling, but add ECR, image build, and cold
pull complexity.

## The Simpler Solution

Do not run Chrome in Lambda. Call the Riddle API from the Lambda function and
let Riddle run the browser outside the deployment package.

```js
const response = await fetch("https://api.riddledc.com/v1/run", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ url: "https://example.com" })
});

const screenshot = await response.arrayBuffer();
```

The Lambda deployment adds 0 MB of Chromium, avoids layers, and keeps the
function as a small HTTP client.

## Time Comparison

- Puppeteer + Layers: 4-8 hours setup, 8-15 second cold starts, monthly updates.
- `@sparticuz/chromium`: 2-4 hours setup, 5-10 second cold starts, version tracking.
- Container Image: 4-6 hours setup, 10-20 second cold starts, image maintenance.
- Riddle API: 5 minutes setup, no Chrome cold start, no Chromium maintenance.

## Call to Action

Skip the Lambda Chrome struggle and get screenshots without managing Chromium
infrastructure.

