invoke_with_response_stream
¶
invoke_with_response_stream(
function_name: NamespacedFunctionName,
*,
config_overrides: Optional[LambdaClientConfig] = 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,
) -> Generator[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/_lambda.py
4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 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 | |