Skip to content

Commit f2298c3

Browse files
committed
fix: api_gateway debug events now end with newlines
Newlines are now emitted at the end of api_gateway debug JSON events. This resolves an issue where the debug events would be combined with CloudWatch EMF metrics, resulting in the metrics being ignored.
1 parent 7846cdb commit f2298c3

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

aws_lambda_powertools/event_handler/api_gateway.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ def resolve(self, event, context) -> Dict[str, Any]:
531531
event = event.raw_event
532532

533533
if self._debug:
534-
print(self._json_dump(event), end="")
534+
print(self._json_dump(event))
535535

536536
# Populate router(s) dependencies without keeping a reference to each registered router
537537
BaseRouter.current_event = self._to_proxy_event(event)

tests/functional/event_handler/test_api_gateway.py

+1
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,7 @@ def test_debug_print_event(capsys):
829829

830830
# THEN print the event
831831
out, err = capsys.readouterr()
832+
assert "\n" in out
832833
assert json.loads(out) == event
833834

834835

0 commit comments

Comments
 (0)