From aa309996125414d56a7a87ce4e67ab934c14a753 Mon Sep 17 00:00:00 2001 From: Max Wilson Date: Wed, 19 Jun 2024 01:01:07 -0400 Subject: [PATCH] Guard against missing data --- lib/broadway_cloud_pub_sub/pull_client.ex | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/broadway_cloud_pub_sub/pull_client.ex b/lib/broadway_cloud_pub_sub/pull_client.ex index 96a3468..140da35 100644 --- a/lib/broadway_cloud_pub_sub/pull_client.ex +++ b/lib/broadway_cloud_pub_sub/pull_client.ex @@ -171,8 +171,7 @@ defmodule BroadwayCloudPubSub.PullClient do %{message | "data" => Base.decode64!(encoded_data)} end - defp decode_message(%{"data" => nil} = message), do: message - defp decode_message(%{"attributes" => %{"payloadFormat" => "NONE"}} = message), do: message + defp decode_message(message) when is_map(message) and not is_map_key(message, "data"), do: message defp headers(config) do token = get_token(config)