All deployment configuration lives in a single file:Documentation Index
Fetch the complete documentation index at: https://mintlify.com/barchart/aws-lambda-pdf-generator/llms.txt
Use this file to discover all available pages before exploring further.
packages/api/serverless.yml. This YAML file drives the Serverless framework and controls everything from Lambda memory allocation and timeouts, to environment variables, CORS headers, and the S3 bucket used for large HTTP responses. Edit this file before running yarn deploy:prod or yarn deploy:stage to tailor the stack to your environment.
Lambda Function Settings
The stack defines two Lambda functions. The resource-intensiveprint function is tuned for Chromium workloads; the serviceRead function uses Serverless framework defaults.
| Setting | print function | serviceRead function |
|---|---|---|
| Runtime | nodejs20.x | nodejs20.x |
| Memory | 2048 MB | Default (1024 MB) |
| Timeout | 30 seconds | Default (6 seconds) |
| CloudWatch log retention | 90 days | 90 days |
The 30-second timeout on the
print function mirrors the maximum integration timeout enforced by API Gateway. Increasing it beyond 30 seconds in serverless.yml will not extend the effective limit for synchronous HTTP requests.Environment Variables
The following environment variables are injected into every Lambda function at deploy time. They are defined underprovider.environment in serverless.yml and can be overridden per function if needed.
| Variable | Default value | Description |
|---|---|---|
NODE_ENV | stage or prod | Set to the Serverless stage name. Use this to branch application logic between environments. |
S3_LARGE_HTTP_RESPONSE_REGION | us-east-1 | AWS region of the S3 bucket used to store oversized Lambda responses. |
S3_LARGE_HTTP_RESPONSE_BUCKET | barchart-aws-lambda-responses | Name of the S3 bucket used for large HTTP responses that exceed API Gateway’s 10 MB payload limit. |
CORS Configuration
CORS is enabled globally for all endpoints. The default policy allows requests from any origin and accepts the following headers:Accept-EncodingContent-TypeContent-LengthX-Amz-DateAuthorizationX-Api-KeyX-Amz-Security-TokenX-Amz-User-AgentAccess-Control-Allow-OriginAccess-Control-Allow-HeadersAccess-Control-Allow-Methods
allowCredentials is set to false. To restrict the allowed origin to a specific domain, change the cors.origin value under custom in serverless.yml.
Lambda Layer
TheHeadlessChromium layer packages Chromium v122 and is built locally before every deployment by the predeploy script (make clean && make all). The Makefile clones the @sparticuz/chromium repository at tag v122.0.0, compiles it, and writes the output to layers/chromium-v122.zip.
| Property | Value |
|---|---|
| Layer name | serverless-headless-chromium-{stage}-v122 |
| Compatible runtimes | nodejs20.x |
| Artifact path | packages/api/layers/chromium-v122.zip |
| Attached to | print function only |
serviceRead function does not attach this layer because it never invokes Chromium.
Deployment Bucket
The Serverless framework uploads deployment artifacts (CloudFormation templates, zipped function code, and the Chromium layer) to an S3 bucket before applying the stack. The default bucket isbarchart-serverless-deployments, configured under provider.deploymentBucket.
Change this to a bucket you own before deploying to your own AWS account.
serverless.yml Reference
The following snippet shows the full configuration section of packages/api/serverless.yml: