Files
PMTiles/serverless/aws/README.md
James Scott-Brown ee86cb6c82 clarify build instructions for AWS lambda function
Doing a clean checkout then npm run build isn't enough to build the Lambda function - it will result in errors like 

```
X [ERROR] Could not resolve "fflate"

    ../../js/index.ts:1:31:
      1 │ import { decompressSync } from "fflate";
        ╵                                ~~~~~~~~

  You can mark the path "fflate" as external to exclude it from the bundle, which will remove this
  error.
```
2023-03-06 16:22:21 +00:00

38 lines
882 B
Markdown

# Protomaps on AWS
See installation and configuration instructions at [Protomaps Docs: Deploy on AWS](https://protomaps.com/docs/cdn/aws)
## Development
The code for the lambda function imports from the top level `js/` directory. You will therfore need to first run `npm install` and `npm run build` in the `js/` directory, and then run `npm run build` in the `serverless/aws` directory.
You should then be able to build the Lambda ZIP:
```sh
npm run build
```
Upload the resulting `dist/lambda_function.zip` using the Lambda console or copy and paste `dist/index.mjs`.
## Test Events
JSON for simulating tile requests in the Lambda development console.
Lambda Function URLs:
```json
{
"rawPath": "/my-tileset-name/0/0/0.mvt"
}
```
API Gateway (REST API with Lambda Proxy Integration):
```json
{
"pathParameters": {
"proxy": "my-tileset-name/0/0/0.mvt"
}
}
```