You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/event-handler/rest.md
+22-22Lines changed: 22 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ status: new
5
5
---
6
6
7
7
!!! warning "Feature status"
8
-
This feature is under active development and may undergo significant changes. We recommend using it in non-critical workloads and [providing feedback](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose) to help us improve it.
8
+
This feature is under active development and may undergo significant changes. We recommend using it in non-critical workloads and [providing feedback](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose){target="_blank"} to help us improve it.
9
9
10
10
Event handler for Amazon API Gateway REST and HTTP APIs, Application Loader Balancer (ALB), Lambda Function URLs, and VPC Lattice.
11
11
@@ -48,7 +48,7 @@ When a request is received, the event handler will automatically convert the eve
48
48
49
49
#### Response auto-serialization
50
50
51
-
!!! tip "Want full control over the response, headers, and status code? Read about the `Response` object here."
51
+
!!! tip "Want full control over the response, headers, and status code? Read about it in the [Fine grained responses](#fine-grained-responses) section."
52
52
53
53
For your convenience, when you return a JavaScript object from your route handler, we automatically perform these actions:
54
54
@@ -121,7 +121,7 @@ If you need to accept multiple HTTP methods in a single function, or support an
121
121
### Data validation
122
122
123
123
!!! note "Coming soon"
124
-
Please open an issue if you would like us to prioritize this feature.
124
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose) if you would like us to prioritize this feature.
125
125
126
126
### Accessing request details
127
127
@@ -130,27 +130,27 @@ You can access request details such as headers, query parameters, and body using
130
130
### Handling not found routes
131
131
132
132
!!! note "Coming soon"
133
-
Please open an issue if you would like us to prioritize this feature.
133
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose){target="_blank"} if you would like us to prioritize this feature.
134
134
135
135
### Error handling
136
136
137
137
!!! note "Coming soon"
138
-
Please open an issue if you would like us to prioritize this feature.
138
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose){target="_blank"} if you would like us to prioritize this feature.
139
139
140
140
### Throwing HTTP errors
141
141
142
142
!!! note "Coming soon"
143
-
Please open an issue if you would like us to prioritize this feature.
143
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose){target="_blank"} if you would like us to prioritize this feature.
144
144
145
145
### Enabling SwaggerUI
146
146
147
147
!!! note "Coming soon"
148
-
Please open an issue if you would like us to prioritize this feature.
148
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose){target="_blank"} if you would like us to prioritize this feature.
149
149
150
150
### Custom domains
151
151
152
152
!!! note "Coming soon"
153
-
Please open an issue if you would like us to prioritize this feature.
153
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose){target="_blank"} if you would like us to prioritize this feature.
154
154
155
155
## Advanced
156
156
@@ -478,14 +478,14 @@ example, you might want to add additional headers, cookies, or set a custom cont
478
478
### Response streaming
479
479
480
480
!!! note "Coming soon"
481
-
Please open an issue if you would like us to prioritize this feature.
481
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose) if you would like us to prioritize this feature.
482
482
483
483
### Compress
484
484
485
485
You can compress with gzip and base64 encode your responses via the `compress` parameter. You have the option to pass the `compress` parameter when working with a specific route or setting the correct `Accept-Encoding` header in the `Response` object.
486
486
487
487
!!! note "Coming soon"
488
-
Please open an issue if you would like us to prioritize this feature.
488
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose) if you would like us to prioritize this feature.
489
489
490
490
### Binary responses
491
491
@@ -500,7 +500,7 @@ Like the `compress` feature, the client must send the `Accept` header with the c
500
500
Lambda Function URLs handle binary media types automatically.
501
501
502
502
!!! note "Coming soon"
503
-
Please open an issue if you would like us to prioritize this feature.
503
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose) if you would like us to prioritize this feature.
504
504
505
505
### Debug mode
506
506
@@ -509,7 +509,7 @@ You can enable debug mode via the `POWERTOOLS_DEV` environment variable.
509
509
This will enable full stack traces errors in the response, log request and responses, and set CORS in development mode.
510
510
511
511
!!! note "Coming soon"
512
-
Please open an issue if you would like us to prioritize this feature.
512
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose) if you would like us to prioritize this feature.
513
513
514
514
### OpenAPI
515
515
@@ -518,14 +518,14 @@ When you enable [Data Validation](#data-validation), we use a combination of Zod
518
518
In OpenAPI documentation tools like [SwaggerUI](#enabling-swaggerui), these annotations become readable descriptions, offering a self-explanatory API interface. This reduces boilerplate code while improving functionality and enabling auto-documentation.
519
519
520
520
!!! note "Coming soon"
521
-
Please open an issue if you would like us to prioritize this feature.
521
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose) if you would like us to prioritize this feature.
522
522
523
523
### Split routers
524
524
525
525
As you grow the number of routes a given Lambda function should handle, it is natural to either break into smaller Lambda functions, or split routes into separate files to ease maintenance - that's where the split `Router` feature is useful.
526
526
527
527
!!! note "Coming soon"
528
-
Please open an issue if you would like us to prioritize this feature.
528
+
Please [open an issue](https://github.com/aws-powertools/powertools-lambda-typescript/issues/new/choose) if you would like us to prioritize this feature.
529
529
530
530
### Considerations
531
531
@@ -554,7 +554,7 @@ _**Downsides**_
554
554
555
555
***Cold starts.** Frequent deployments and/or high load can diminish the benefit of monolithic functions depending on your latency requirements, due to the [Lambda scaling model](https://docs.aws.amazon.com/lambda/latest/dg/invocation-scaling.html){target="_blank"}. Always load test to find a pragmatic balance between customer experience and developer cognitive load.
556
556
***Granular security permissions.** The micro function approach enables you to use fine-grained permissions and access controls, separate external dependencies and code signing at the function level. Conversely, you could have multiple functions while duplicating the final code artifact in a monolithic approach. Regardless, least privilege can be applied to either approaches.
557
-
***Higher risk per deployment.** A misconfiguration or invalid import can cause disruption if not caught early in automated testing. Multiple functions can mitigate misconfigurations but they will uld still share the same code artifact. You can further minimize risks with multiple environments in your CI/CD pipeline.
557
+
***Higher risk per deployment.** A misconfiguration or invalid import can cause disruption if not caught early in automated testing. Multiple functions can mitigate misconfigurations but they will still share the same code artifact. You can further minimize risks with multiple environments in your CI/CD pipeline.
558
558
559
559
#### Micro function
560
560
@@ -564,16 +564,16 @@ A micro function means that your final code artifact will be different to each f
564
564
565
565
_**Benefits**_
566
566
567
-
**Granular scaling.** A micro function can benefit from the [Lambda scaling model](https://docs.aws.amazon.com/lambda/latest/dg/invocation-scaling.html){target="_blank"} to scale differently depending on each part of your application. Concurrency controls and provisioned concurrency can also be used at a granular level for capacity management.
568
-
**Discoverability.** Micro functions are easier to visualize when using distributed tracing. Their high-level architectures can be self-explanatory, and complexity is highly visible — assuming each function is named after the business purpose it serves.
569
-
**Package size.** An independent function can be significantly smaller (KB vs MB) depending on the external dependencies it requires to perform its purpose. Conversely, a monolithic approach can benefit from [Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html){target="_blank"} to optimize builds for external dependencies.
567
+
***Granular scaling.** A micro function can benefit from the [Lambda scaling model](https://docs.aws.amazon.com/lambda/latest/dg/invocation-scaling.html){target="_blank"} to scale differently depending on each part of your application. Concurrency controls and provisioned concurrency can also be used at a granular level for capacity management.
568
+
***Discoverability.** Micro functions are easier to visualize when using distributed tracing. Their high-level architectures can be self-explanatory, and complexity is highly visible — assuming each function is named after the business purpose it serves.
569
+
***Package size.** An independent function can be significantly smaller (KB vs MB) depending on the external dependencies it requires to perform its purpose. Conversely, a monolithic approach can benefit from [Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/invocation-layers.html){target="_blank"} to optimize builds for external dependencies.
570
570
571
571
_**Downsides**_
572
572
573
-
**Upfront investment.** You need custom build tooling to bundle assets, including [native bindings for runtime compatibility](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html){target="_blank"}. Operations become more elaborate — you need to standardize tracing labels/annotations, structured logging, and metrics to pinpoint root causes.
574
-
**Engineering discipline** is necessary for both approaches. However, the micro-function approach requires further attention to consistency as the number of functions grow, just like any distributed system.
575
-
**Harder to share code.** Shared code must be carefully evaluated to avoid unnecessary deployments when this code changes. Equally, if shared code isn't a library, your development, building, deployment tooling need to accommodate the distinct layout.
576
-
**Slower safe deployments.** Safely deploying multiple functions require coordination — AWS CodeDeploy deploys and verifies each function sequentially. This increases lead time substantially (minutes to hours) depending on the deployment strategy you choose. You can mitigate it by selectively enabling it in prod-like environments only, and where the risk profile is applicable.
573
+
***Upfront investment.** You need custom build tooling to bundle assets, including [native bindings for runtime compatibility](https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html){target="_blank"}. Operations become more elaborate — you need to standardize tracing labels/annotations, structured logging, and metrics to pinpoint root causes.
574
+
***Engineering discipline** is necessary for both approaches. However, the micro-function approach requires further attention to consistency as the number of functions grow, just like any distributed system.
575
+
***Harder to share code.** Shared code must be carefully evaluated to avoid unnecessary deployments when this code changes. Equally, if shared code isn't a library, your development, building, deployment tooling need to accommodate the distinct layout.
576
+
***Slower safe deployments.** Safely deploying multiple functions require coordination — AWS CodeDeploy deploys and verifies each function sequentially. This increases lead time substantially (minutes to hours) depending on the deployment strategy you choose. You can mitigate it by selectively enabling it in prod-like environments only, and where the risk profile is applicable.
577
577
Automated testing, operational and security reviews are essential to stability in either approaches.
0 commit comments