Skip to content

parse_auth_type missing "none" clause causes config import to fail for Elasticsearch sinks #2123

@juanherrera-jpy

Description

@juanherrera-jpy

Bug Description

sequin config export produces auth_type: none for Elasticsearch sinks that have no authentication configured. However, sequin config apply (and CONFIG_FILE_PATH boot-time loading) fails because Sequin.Transforms.parse_auth_type/1 does not handle the "none" value.

Steps to Reproduce

  1. Create an Elasticsearch sink with no authentication (auth_type: none)
  2. Export config: sequin config export > config.yaml
  3. Apply to a fresh instance: sequin config apply config.yaml

Error

(FunctionClauseError) no function clause matching in Sequin.Transforms.parse_auth_type/1
    Sequin.Transforms.parse_auth_type("none")
    lib/sequin/transforms/transforms.ex:1319: Sequin.Transforms.parse_sink/2

If auth_type is removed from the YAML entirely, it defaults to :api_key via parse_auth_type(nil), which then requires auth_value — so there's no way to import an Elasticsearch sink without authentication.

Root Cause

In lib/sequin/transforms/transforms.ex (lines 1622-1625):

defp parse_auth_type("api_key"), do: :api_key
defp parse_auth_type("basic"), do: :basic
defp parse_auth_type("bearer"), do: :bearer
defp parse_auth_type(nil), do: :api_key

Missing: defp parse_auth_type("none"), do: :none

The rest of the codebase correctly supports :none:

  • Schema (lib/sequin/consumers/elasticsearch_sink.ex:15): field :auth_type, Ecto.Enum, values: [:none, :api_key, :basic, :bearer]
  • Changeset (line 35-36): if auth_type == :none do put_change(changeset, :auth_value, nil)
  • Client (lib/sequin/sinks/elasticsearch/client.ex:131): :none -> [] (no auth headers)
  • Export (lib/sequin/transforms/transforms.ex:425): exports auth_type: sink.auth_type which produces "none"

Proposed Fix

Add the missing clause:

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
defp parse_auth_type(nil), do: :api_key

Environment

  • Sequin version: v0.14.6 (latest as of 2026-03-05)
  • Docker image: sequin/sequin:latest

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions