Skip to content

Commit 2a5606e

Browse files
author
awstools
committed
feat(client-lambda): Added SerializedRequestEntityTooLargeException to Lambda Invoke API
1 parent e739472 commit 2a5606e

File tree

7 files changed

+14608
-14639
lines changed

7 files changed

+14608
-14639
lines changed

clients/client-lambda/src/commands/DeleteFunctionCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export interface DeleteFunctionCommandInput extends DeleteFunctionRequest {}
2828
export interface DeleteFunctionCommandOutput extends __MetadataBearer {}
2929

3030
/**
31-
* <p>Deletes a Lambda function. To delete a specific function version, use the <code>Qualifier</code> parameter. Otherwise, all versions and aliases are deleted. This doesn't require the user to have explicit permissions for <a>DeleteAlias</a>.</p> <p>To delete Lambda event source mappings that invoke a function, use <a>DeleteEventSourceMapping</a>. For Amazon Web Services services and resources that invoke your function directly, delete the trigger in the service where you originally configured it.</p>
31+
* <p>Deletes a Lambda function. To delete a specific function version, use the <code>Qualifier</code> parameter. Otherwise, all versions and aliases are deleted. This doesn't require the user to have explicit permissions for <a>DeleteAlias</a>.</p> <note> <p>A deleted Lambda function cannot be recovered. Ensure that you specify the correct function name and version before deleting.</p> </note> <p>To delete Lambda event source mappings that invoke a function, use <a>DeleteEventSourceMapping</a>. For Amazon Web Services services and resources that invoke your function directly, delete the trigger in the service where you originally configured it.</p>
3232
* @example
3333
* Use a bare-bones client and the command you need to make an API call.
3434
* ```javascript

clients/client-lambda/src/commands/InvokeAsyncCommand.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export interface InvokeAsyncCommandInput extends Omit<InvokeAsyncRequest, "Invok
3131
export interface InvokeAsyncCommandOutput extends InvokeAsyncResponse, __MetadataBearer {}
3232

3333
/**
34-
* <important> <p>For asynchronous function invocation, use <a>Invoke</a>.</p> </important> <p>Invokes a function asynchronously.</p> <note> <p>If you do use the InvokeAsync action, note that it doesn't support the use of X-Ray active tracing. Trace ID is not propagated to the function, even if X-Ray active tracing is turned on.</p> </note>
34+
* <note> <p>For asynchronous function invocation, use <a>Invoke</a>.</p> </note> <p>Invokes a function asynchronously.</p> <note> <p>The payload limit is 256KB. For larger payloads, for up to 1MB, use <a>Invoke</a>.</p> </note> <note> <p>If you do use the InvokeAsync action, note that it doesn't support the use of X-Ray active tracing. Trace ID is not propagated to the function, even if X-Ray active tracing is turned on.</p> </note>
3535
*
3636
* @deprecated deprecated
3737
* @example

clients/client-lambda/src/commands/InvokeCommand.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export type InvokeCommandOutputType = Omit<InvocationResponse, "Payload"> & {
4848
export interface InvokeCommandOutput extends InvokeCommandOutputType, __MetadataBearer {}
4949

5050
/**
51-
* <p>Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. By default, Lambda invokes your function synchronously (i.e. the<code>InvocationType</code> is <code>RequestResponse</code>). To invoke a function asynchronously, set <code>InvocationType</code> to <code>Event</code>. Lambda passes the <code>ClientContext</code> object to your function for synchronous invocations only.</p> <p>For <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-sync.html">synchronous invocation</a>, details about the function response, including errors, are included in the response body and headers. For either invocation type, you can find more information in the <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-functions.html">execution log</a> and <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html">trace</a>.</p> <p>When an error occurs, your function may be invoked multiple times. Retry behavior varies by error type, client, event source, and invocation type. For example, if you invoke a function asynchronously and it returns an error, Lambda executes the function up to two more times. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-retries.html">Error handling and automatic retries in Lambda</a>.</p> <p>For <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html">asynchronous invocation</a>, Lambda adds events to a queue before sending them to your function. If your function does not have enough capacity to keep up with the queue, events may be lost. Occasionally, your function may receive the same event multiple times, even if no error occurs. To retain events that were not processed, configure your function with a <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-dlq">dead-letter queue</a>.</p> <p>The status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your function from executing, such as permissions errors, <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html">quota</a> errors, or issues with your function's code and configuration. For example, Lambda returns <code>TooManyRequestsException</code> if running the function would cause you to exceed a concurrency limit at either the account level (<code>ConcurrentInvocationLimitExceeded</code>) or function level (<code>ReservedFunctionConcurrentInvocationLimitExceeded</code>).</p> <p>For functions with a long timeout, your client might disconnect during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings.</p> <p>This operation requires permission for the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awslambda.html">lambda:InvokeFunction</a> action. For details on how to set up permissions for cross-account invocations, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html#permissions-resource-xaccountinvoke">Granting function access to other accounts</a>.</p>
51+
* <p>Invokes a Lambda function. You can invoke a function synchronously (and wait for the response), or asynchronously. By default, Lambda invokes your function synchronously (i.e. the<code>InvocationType</code> is <code>RequestResponse</code>). To invoke a function asynchronously, set <code>InvocationType</code> to <code>Event</code>. Lambda passes the <code>ClientContext</code> object to your function for synchronous invocations only.</p> <p>For synchronous invocations, the maximum payload size is 6 MB. For asynchronous invocations, the maximum payload size is 1 MB.</p> <p>For <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-sync.html">synchronous invocation</a>, details about the function response, including errors, are included in the response body and headers. For either invocation type, you can find more information in the <a href="https://docs.aws.amazon.com/lambda/latest/dg/monitoring-functions.html">execution log</a> and <a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-x-ray.html">trace</a>.</p> <p>When an error occurs, your function may be invoked multiple times. Retry behavior varies by error type, client, event source, and invocation type. For example, if you invoke a function asynchronously and it returns an error, Lambda executes the function up to two more times. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-retries.html">Error handling and automatic retries in Lambda</a>.</p> <p>For <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html">asynchronous invocation</a>, Lambda adds events to a queue before sending them to your function. If your function does not have enough capacity to keep up with the queue, events may be lost. Occasionally, your function may receive the same event multiple times, even if no error occurs. To retain events that were not processed, configure your function with a <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-dlq">dead-letter queue</a>.</p> <p>The status code in the API response doesn't reflect function errors. Error codes are reserved for errors that prevent your function from executing, such as permissions errors, <a href="https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-limits.html">quota</a> errors, or issues with your function's code and configuration. For example, Lambda returns <code>TooManyRequestsException</code> if running the function would cause you to exceed a concurrency limit at either the account level (<code>ConcurrentInvocationLimitExceeded</code>) or function level (<code>ReservedFunctionConcurrentInvocationLimitExceeded</code>).</p> <p>For functions with a long timeout, your client might disconnect during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings.</p> <p>This operation requires permission for the <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/list_awslambda.html">lambda:InvokeFunction</a> action. For details on how to set up permissions for cross-account invocations, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/access-control-resource-based.html#permissions-resource-xaccountinvoke">Granting function access to other accounts</a>.</p>
5252
* @example
5353
* Use a bare-bones client and the command you need to make an API call.
5454
* ```javascript
@@ -152,6 +152,9 @@ export interface InvokeCommandOutput extends InvokeCommandOutputType, __Metadata
152152
* @throws {@link ResourceNotReadyException} (server fault)
153153
* <p>The function is inactive and its VPC connection is no longer available. Wait for the VPC connection to reestablish and try again.</p>
154154
*
155+
* @throws {@link SerializedRequestEntityTooLargeException} (client fault)
156+
* <p>The processed request payload exceeded the <code>Invoke</code> request body size limit for asynchronous invocations. While the event payload may be under 1 MB, the size after internal serialization exceeds the maximum allowed size for asynchronous invocations.</p>
157+
*
155158
* @throws {@link ServiceException} (server fault)
156159
* <p>The Lambda service encountered an internal error.</p>
157160
*

clients/client-lambda/src/commands/InvokeWithResponseStreamCommand.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ export interface InvokeWithResponseStreamCommandOutput extends InvokeWithRespons
152152
* @throws {@link ResourceNotReadyException} (server fault)
153153
* <p>The function is inactive and its VPC connection is no longer available. Wait for the VPC connection to reestablish and try again.</p>
154154
*
155+
* @throws {@link SerializedRequestEntityTooLargeException} (client fault)
156+
* <p>The processed request payload exceeded the <code>Invoke</code> request body size limit for asynchronous invocations. While the event payload may be under 1 MB, the size after internal serialization exceeds the maximum allowed size for asynchronous invocations.</p>
157+
*
155158
* @throws {@link ServiceException} (server fault)
156159
* <p>The Lambda service encountered an internal error.</p>
157160
*

clients/client-lambda/src/models/models_0.ts

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ export interface AddPermissionRequest {
408408
FunctionUrlAuthType?: FunctionUrlAuthType | undefined;
409409

410410
/**
411-
* <p>Restricts the <code>lambda:InvokeFunction</code> action to calls coming from a function URL. When set to <code>true</code>, this prevents the principal from invoking the function by any means other than the function URL. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html">Control access to Lambda function URLs</a>.</p>
411+
* <p>Restricts the <code>lambda:InvokeFunction</code> action to function URL calls. When set to <code>true</code>, this prevents the principal from invoking the function by any means other than the function URL. For more information, see <a href="https://docs.aws.amazon.com/lambda/latest/dg/urls-auth.html">Control access to Lambda function URLs</a>.</p>
412412
* @public
413413
*/
414414
InvokedViaFunctionUrl?: boolean | undefined;
@@ -913,7 +913,7 @@ export interface UpdateCodeSigningConfigResponse {
913913
*/
914914
export interface OnFailure {
915915
/**
916-
* <p>The Amazon Resource Name (ARN) of the destination resource.</p> <p>To retain records of unsuccessful <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">asynchronous invocations</a>, you can configure an Amazon SNS topic, Amazon SQS queue, Amazon S3 bucket, Lambda function, or Amazon EventBridge event bus as the destination.</p> <p>To retain records of failed invocations from <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html">Kinesis</a>, <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html">DynamoDB</a>, <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kafka.html#services-smaa-onfailure-destination">self-managed Kafka</a> or <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-onfailure-destination">Amazon MSK</a>, you can configure an Amazon SNS topic, Amazon SQS queue, or Amazon S3 bucket as the destination.</p>
916+
* <p>The Amazon Resource Name (ARN) of the destination resource.</p> <p>To retain records of unsuccessful <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html#invocation-async-destinations">asynchronous invocations</a>, you can configure an Amazon SNS topic, Amazon SQS queue, Amazon S3 bucket, Lambda function, or Amazon EventBridge event bus as the destination.</p> <note> <p>Amazon SNS destinations have a message size limit of 256 KB. If the combined size of the function request and response payload exceeds the limit, Lambda will drop the payload when sending <code>OnFailure</code> event to the destination. For details on this behavior, refer to <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html">Retaining records of asynchronous invocations</a>.</p> </note> <p>To retain records of failed invocations from <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kinesis.html">Kinesis</a>, <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-ddb.html">DynamoDB</a>, <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-kafka.html#services-smaa-onfailure-destination">self-managed Kafka</a> or <a href="https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html#services-msk-onfailure-destination">Amazon MSK</a>, you can configure an Amazon SNS topic, Amazon SQS queue, or Amazon S3 bucket as the destination.</p>
917917
* @public
918918
*/
919919
Destination?: string | undefined;
@@ -925,7 +925,7 @@ export interface OnFailure {
925925
*/
926926
export interface OnSuccess {
927927
/**
928-
* <p>The Amazon Resource Name (ARN) of the destination resource.</p>
928+
* <p>The Amazon Resource Name (ARN) of the destination resource.</p> <note> <p>Amazon SNS destinations have a message size limit of 256 KB. If the combined size of the function request and response payload exceeds the limit, Lambda will drop the payload when sending <code>OnFailure</code> event to the destination. For details on this behavior, refer to <a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async-retain-records.html">Retaining records of asynchronous invocations</a>.</p> </note>
929929
* @public
930930
*/
931931
Destination?: string | undefined;
@@ -3892,7 +3892,7 @@ export interface InvocationRequest {
38923892
ClientContext?: string | undefined;
38933893

38943894
/**
3895-
* <p>The JSON that you want to provide to your Lambda function as input.</p> <p>You can enter the JSON directly. For example, <code>--payload '\{ "key": "value" \}'</code>. You can also specify a file path. For example, <code>--payload file://payload.json</code>.</p>
3895+
* <p>The JSON that you want to provide to your Lambda function as input. The maximum payload size is 6 MB for synchronous invocations and 1 MB for asynchronous invocations.</p> <p>You can enter the JSON directly. For example, <code>--payload '\{ "key": "value" \}'</code>. You can also specify a file path. For example, <code>--payload file://payload.json</code>.</p>
38963896
* @public
38973897
*/
38983898
Payload?: Uint8Array | undefined;
@@ -4117,6 +4117,33 @@ export class ResourceNotReadyException extends __BaseException {
41174117
}
41184118
}
41194119

4120+
/**
4121+
* <p>The processed request payload exceeded the <code>Invoke</code> request body size limit for asynchronous invocations. While the event payload may be under 1 MB, the size after internal serialization exceeds the maximum allowed size for asynchronous invocations.</p>
4122+
* @public
4123+
*/
4124+
export class SerializedRequestEntityTooLargeException extends __BaseException {
4125+
readonly name: "SerializedRequestEntityTooLargeException" = "SerializedRequestEntityTooLargeException";
4126+
readonly $fault: "client" = "client";
4127+
/**
4128+
* <p>The error type.</p>
4129+
* @public
4130+
*/
4131+
Type?: string | undefined;
4132+
4133+
/**
4134+
* @internal
4135+
*/
4136+
constructor(opts: __ExceptionOptionType<SerializedRequestEntityTooLargeException, __BaseException>) {
4137+
super({
4138+
name: "SerializedRequestEntityTooLargeException",
4139+
$fault: "client",
4140+
...opts,
4141+
});
4142+
Object.setPrototypeOf(this, SerializedRequestEntityTooLargeException.prototype);
4143+
this.Type = opts.Type;
4144+
}
4145+
}
4146+
41204147
/**
41214148
* <p>The <code>afterRestore()</code> <a href="https://docs.aws.amazon.com/lambda/latest/dg/snapstart-runtime-hooks.html">runtime hook</a> encountered an error. For more information, check the Amazon CloudWatch logs.</p>
41224149
* @public

clients/client-lambda/src/protocols/Aws_restJson1.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ import {
301301
ScalingConfig,
302302
SelfManagedEventSource,
303303
SelfManagedKafkaEventSourceConfig,
304+
SerializedRequestEntityTooLargeException,
304305
ServiceException,
305306
SnapStart,
306307
SnapStartException,
@@ -3736,6 +3737,9 @@ const de_CommandError = async (output: __HttpResponse, context: __SerdeContext):
37363737
case "ResourceNotReadyException":
37373738
case "com.amazonaws.lambda#ResourceNotReadyException":
37383739
throw await de_ResourceNotReadyExceptionRes(parsedOutput, context);
3740+
case "SerializedRequestEntityTooLargeException":
3741+
case "com.amazonaws.lambda#SerializedRequestEntityTooLargeException":
3742+
throw await de_SerializedRequestEntityTooLargeExceptionRes(parsedOutput, context);
37393743
case "SnapStartException":
37403744
case "com.amazonaws.lambda#SnapStartException":
37413745
throw await de_SnapStartExceptionRes(parsedOutput, context);
@@ -4411,6 +4415,27 @@ const de_ResourceNotReadyExceptionRes = async (
44114415
return __decorateServiceException(exception, parsedOutput.body);
44124416
};
44134417

4418+
/**
4419+
* deserializeAws_restJson1SerializedRequestEntityTooLargeExceptionRes
4420+
*/
4421+
const de_SerializedRequestEntityTooLargeExceptionRes = async (
4422+
parsedOutput: any,
4423+
context: __SerdeContext
4424+
): Promise<SerializedRequestEntityTooLargeException> => {
4425+
const contents: any = map({});
4426+
const data: any = parsedOutput.body;
4427+
const doc = take(data, {
4428+
Type: __expectString,
4429+
message: __expectString,
4430+
});
4431+
Object.assign(contents, doc);
4432+
const exception = new SerializedRequestEntityTooLargeException({
4433+
$metadata: deserializeMetadata(parsedOutput),
4434+
...contents,
4435+
});
4436+
return __decorateServiceException(exception, parsedOutput.body);
4437+
};
4438+
44144439
/**
44154440
* deserializeAws_restJson1ServiceExceptionRes
44164441
*/

0 commit comments

Comments
 (0)