Invocation Flowchart
graph TD
A["Lambda Invocation"] --> |"process_request(event: LambdaEvent<VercelEvent>) → ProxyRequest"| B[ProxyRequest]
B --> |"handler_fn(req: ProxyRequest) → Future<Output = Result<impl IntoResponse, ProxyError>>"| C["Runtime calls handler_fn"]
C --> |"Ok(r) => process_response(r)"| D["ProxyResponse"]
C --> |"Err(e) => process_error(e)"| E["ProxyError"]
What should be in the documentation
VERCEL_BUILDER_DEBUG=true
Merging Endpoints?
Data structure
- The Root
Cargo.toml
is setting up the workspaces for the endpoints. - The Endpoints (
api/**/main.rs
) export a function with the signature: pub async fn handler(_req: ProxyRequest) -> Result<impl IntoResponse, ProxyError>
.
.
├── api
│ ├── endpoint_1
│ │ ├── Cargo.toml
│ │ └── src
│ │ └── main.rs
│ └── endpoint_2
│ ├── Cargo.toml
│ └── src
│ └── main.rs
├── Cargo.lock
└── Cargo.toml
Builder
- Installs the Rust toolchain
- Injects a pre-defined
entry
package in the workspace that imports all endpoint handler
fn (proc macro) with runtime initialization and routing logic.
Event
[https://github.com/awslabs/aws-lambda-rust-runtime/releases/tag/v0.3.0](Base Lambda Runtime Release Notes)
files: {
"files": {
"api/Cargo.lock": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/api/Cargo.lock"
},
"api/Cargo.toml": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/api/Cargo.toml"
},
"api/user.rs": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/api/user.rs"
},
".vercelignore": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/.vercelignore"
},
"package.json": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/package.json"
},
"pnpm-lock.yaml": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/pnpm-lock.yaml"
},
"vercel.json": {
"type": "FileFsRef",
"mode": 33188,
"fsPath": "/vercel/path0/vercel.json"
}
},
"entrypoint": "api/user.rs",
"workPath": "/vercel/path0",
"repoRootPath": "/vercel/path0",
"config": {
"zeroConfig": true,
"functions": {
"api/**/*.rs": {
"runtime": "ecklf-tmp-runtime-test@1.0.4"
}
},
"projectSettings": {
"createdAt": 1674047862614,
"installCommand": null,
"buildCommand": null,
"devCommand": null,
"outputDirectory": null,
"rootDirectory": null,
"framework": null,
"nodeVersion": "18.x"
},
"framework": null,
"nodeVersion": "18.x"
},
"meta": {
"skipDownload": true,
"cliVersion": "28.12.7"
}
}