invoke_with_response_stream
async
¶
invoke_with_response_stream(
function_name: NamespacedFunctionName,
*,
config_overrides: Optional[AsyncLambdaClientConfig] = None,
log_type: Optional[LogType] = None,
client_context: Optional[String] = None,
qualifier: Optional[NumericLatestPublishedOrAliasQualifier] = None,
payload: Optional[Blob] = None,
tenant_id: Optional[TenantId] = None,
invocation_type: Optional[ResponseStreamingInvocationType] = None,
) -> AsyncGenerator[InvokeWithResponseStreamResponse]
Configure your Lambda Event Functions to stream response payloads back to clients. For more information, see Configuring a Lambda function to stream responses.
This operation requires permission for the lambda:InvokeFunction action. For details on how to set up permissions for cross-account invocations, see Granting function access to other accounts.
Parameters:
-
function_name(NamespacedFunctionName) –The name or ARN of the Lambda function.
Name formats
-
Function name –
my-function. -
Function ARN –
arn:aws:lambda:us-west-2:123456789012:function:my-function. -
Partial ARN –
123456789012:function:my-function.
The length constraint applies only to the full ARN. If you specify only the function name, it is limited to 64 characters in length.
-
-
log_type(Optional[LogType], default:None) –Set to
Tailto include the execution log in the response. Applies to synchronously invoked functions only. -
client_context(Optional[String], default:None) –Up to 3,583 bytes of base64-encoded data about the invoking client to pass to the function in the context object.
-
qualifier(Optional[NumericLatestPublishedOrAliasQualifier], default:None) –The alias name.
-
payload(Optional[Blob], default:None) –The JSON that you want to provide to your Lambda function as input.
You can enter the JSON directly. For example,
--payload '{ "key": "value" }'. You can also specify a file path. For example,--payload file://payload.json. -
tenant_id(Optional[TenantId], default:None) –The identifier of the tenant in a multi-tenant Lambda function.
-
invocation_type(Optional[ResponseStreamingInvocationType], default:None) –Use one of the following options:
-
RequestResponse(default) – Invoke the function synchronously. Keep the connection open until the function returns a response or times out. The API operation response includes the function response and additional data. -
DryRun– Validate parameter values and verify that the IAM user or role has permission to invoke the function.
-
Raises:
-
CodeArtifactUserDeletedException–The Lambda function couldn't be invoked because its code artifact user has been deleted. Wait for Lambda to provision a new code artifact user, or update the function's code package to recreate it.
-
CodeArtifactUserFailedException–The Lambda function couldn't be invoked because provisioning of its code artifact user failed. Update the function's code package or check the Lambda function's
StateandStateReasonCodefor additional context. -
CodeArtifactUserPendingException–The Lambda function couldn't be invoked because its code artifact user is still being provisioned. Wait for the function's
Stateto becomeActiveand try the request again. -
EC2AccessDeniedException–Need additional permissions to configure VPC settings.
-
EC2ThrottledException–Amazon EC2 throttled Lambda during Lambda function initialization using the execution role provided for the function.
-
EC2UnexpectedException–Lambda received an unexpected Amazon EC2 client exception while setting up for the Lambda function.
-
EFSIOException–An error occurred when reading from or writing to a connected file system.
-
EFSMountConnectivityException–The Lambda function couldn't make a network connection to the configured file system.
-
EFSMountFailureException–The Lambda function couldn't mount the configured file system due to a permission or configuration issue.
-
EFSMountTimeoutException–The Lambda function made a network connection to the configured file system, but the mount operation timed out.
-
ENILimitReachedException–Lambda couldn't create an elastic network interface in the VPC, specified as part of Lambda function configuration, because the limit for network interfaces has been reached. For more information, see Lambda quotas.
-
InvalidParameterValueException–One of the parameters in the request is not valid.
-
InvalidRequestContentException–The request body could not be parsed as JSON, or a request header is invalid. For example, the 'x-amzn-RequestId' header is not a valid UUID string.
-
InvalidRuntimeException–The runtime or runtime version specified is not supported.
-
InvalidSecurityGroupIDException–The security group ID provided in the Lambda function VPC configuration is not valid.
-
InvalidSubnetIDException–The subnet ID provided in the Lambda function VPC configuration is not valid.
-
InvalidZipFileException–Lambda could not unzip the deployment package.
-
KMSAccessDeniedException–Lambda couldn't decrypt the environment variables because KMS access was denied. Check the Lambda function's KMS permissions.
-
KMSDisabledException–Lambda couldn't decrypt the environment variables because the KMS key used is disabled. Check the Lambda function's KMS key settings.
-
KMSInvalidStateException–Lambda couldn't decrypt the environment variables because the state of the KMS key used is not valid for Decrypt. Check the function's KMS key settings.
-
KMSNotFoundException–Lambda couldn't decrypt the environment variables because the KMS key was not found. Check the function's KMS key settings.
-
NoPublishedVersionException–The function has no published versions available.
-
RecursiveInvocationException–Lambda has detected your function being invoked in a recursive loop with other Amazon Web Services resources and stopped your function's invocation.
-
RequestTooLargeException–The request payload exceeded the
Invokerequest body JSON input quota. For more information, see Lambda quotas. -
ResourceConflictException–The resource already exists, or another operation is in progress.
-
ResourceNotFoundException–The resource specified in the request does not exist.
-
ResourceNotReadyException–The function is inactive and its VPC connection is no longer available. Wait for the VPC connection to reestablish and try again.
-
S3FilesMountConnectivityException–The Lambda function couldn't make a network connection to the configured S3 Files access point.
-
S3FilesMountFailureException–The Lambda function couldn't mount the configured S3 Files access point due to a permission or configuration issue.
-
S3FilesMountTimeoutException–The Lambda function made a network connection to the configured S3 Files access point, but the mount operation timed out.
-
SerializedRequestEntityTooLargeException–The request payload exceeded the maximum allowed size for serialized request entities.
-
ServiceException–The Lambda service encountered an internal error.
-
ServiceQuotaExceededException–The request would exceed a service quota. For more information about Lambda service quotas, see Lambda quotas. To request a quota increase, see Requesting a quota increase in the Service Quotas User Guide.
-
SnapStartException–The
afterRestore()runtime hook encountered an error. For more information, check the Amazon CloudWatch logs. -
SnapStartNotReadyException–Lambda is initializing your function. You can invoke the function when the function state becomes
Active. -
SnapStartRegenerationFailureException–Lambda couldn't regenerate the SnapStart snapshot for the function. SnapStart-enabled functions periodically regenerate snapshots when their underlying runtime or dependencies change; this regeneration failed. Wait for Lambda to retry, or update the function's configuration to trigger a new snapshot. For more information, see Lambda SnapStart.
-
SnapStartTimeoutException–Lambda couldn't restore the snapshot within the timeout limit.
-
SubnetIPAddressLimitReachedException–Lambda couldn't set up VPC access for the Lambda function because one or more configured subnets has no available IP addresses.
-
TooManyRequestsException–The request throughput limit was exceeded. For more information, see Lambda quotas.
-
UnsupportedMediaTypeException–The content type of the
Invokerequest body is not JSON. -
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_lambda/_services/async__lambda.py
4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 | |