Skip to content

Commit

Permalink
Fix parameter validation for self-managed Kafka event source mapping (l…
Browse files Browse the repository at this point in the history
  • Loading branch information
janario authored Mar 25, 2024
1 parent 89b20aa commit 241f5a1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions localstack/services/lambda_/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -1689,10 +1689,15 @@ def create_event_source_mapping(
context: RequestContext,
request: CreateEventSourceMappingRequest,
) -> EventSourceMappingConfiguration:
if "EventSourceArn" not in request:
raise InvalidParameterValueException("Unrecognized event source.", Type="User")
service = None

if "SelfManagedEventSource" in request:
service = "kafka"

service = extract_service_from_arn(request["EventSourceArn"])
if service is None and "EventSourceArn" not in request:
raise InvalidParameterValueException("Unrecognized event source.", Type="User")
if service is None:
service = extract_service_from_arn(request["EventSourceArn"])
if service in ["dynamodb", "kinesis", "kafka"] and "StartingPosition" not in request:
raise InvalidParameterValueException(
"1 validation error detected: Value null at 'startingPosition' failed to satisfy constraint: Member must not be null.",
Expand Down

0 comments on commit 241f5a1

Please sign in to comment.