From 8fbf510f00b1336d16257f49bd1d9143c3266c5d Mon Sep 17 00:00:00 2001 From: Juan Herrera Date: Fri, 6 Mar 2026 08:12:26 -0500 Subject: [PATCH] Fix parse_auth_type missing "none" clause for Elasticsearch sinks Config export produces `auth_type: none` for Elasticsearch sinks without authentication, but config import fails because parse_auth_type/1 doesn't handle the "none" value. Add the missing clause. Closes #2123 Co-Authored-By: Claude Opus 4.6 --- lib/sequin/transforms/transforms.ex | 1 + test/sequin/yaml_loader_test.exs | 30 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/lib/sequin/transforms/transforms.ex b/lib/sequin/transforms/transforms.ex index ebd12dffc..88e6e83fa 100644 --- a/lib/sequin/transforms/transforms.ex +++ b/lib/sequin/transforms/transforms.ex @@ -1619,6 +1619,7 @@ defmodule Sequin.Transforms do end # Helper to parse auth_type + defp parse_auth_type("none"), do: :none defp parse_auth_type("api_key"), do: :api_key defp parse_auth_type("basic"), do: :basic defp parse_auth_type("bearer"), do: :bearer diff --git a/test/sequin/yaml_loader_test.exs b/test/sequin/yaml_loader_test.exs index a00fa908b..1ac0af370 100644 --- a/test/sequin/yaml_loader_test.exs +++ b/test/sequin/yaml_loader_test.exs @@ -1493,6 +1493,36 @@ defmodule Sequin.YamlLoaderTest do } = consumer.sink end + test "creates elasticsearch sink consumer with auth_type none" do + assert :ok = + YamlLoader.apply_from_yml!(""" + #{account_and_db_yml()} + + sinks: + - name: "elasticsearch-no-auth" + database: "test-db" + destination: + type: "elasticsearch" + endpoint_url: "https://elasticsearch.example.com" + index_name: "test-index" + auth_type: "none" + batch_size: 100 + """) + + assert [consumer] = Repo.all(SinkConsumer) + + assert consumer.name == "elasticsearch-no-auth" + + assert %ElasticsearchSink{ + type: :elasticsearch, + endpoint_url: "https://elasticsearch.example.com", + index_name: "test-index", + auth_type: :none, + auth_value: nil, + batch_size: 100 + } = consumer.sink + end + test "creates redis string sink consumer" do assert :ok = YamlLoader.apply_from_yml!("""