Skip to content

NATS does not support Websocket transport. #24285

@gedemagt

Description

@gedemagt

A note for the community

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Problem

NATS support websocket connections via the usual ws:// and wss:// URL-prefixes, as described in the docs: https://docs.nats.io/using-nats/developer/connecting#nats-url

If I specify the correct Websocket port as configured in NATS nothing happens - it seems like it is caught in an infinite connection-loop.

If I instead use the 4222 port, it works.

It seems like it ignores the prefix and just use nats:// no matter what.

Configuration

sinks:
  hub:
    type: nats
    inputs:
      - logs
    url: ws://cloud-broker:8080  # ws://cloud-broker:4222 works
    subject: "subject"
    encoding:
      codec: json
    auth:
      strategy: nkey
      nkey:
        nkey: ""
        seed: ${RELAY_NATS_NKEY_SEED}

Version

vector 0.51.1 (x86_64-unknown-linux-gnu 44c8f1c 2025-11-13 15:16:05.303418529)

Debug Output

2025-11-20T11:10:17.791875Z DEBUG vector::app: Internal log rate limit configured. internal_log_rate_secs=10
2025-11-20T11:10:17.791925Z  INFO vector::app: Log level is enabled. level="trace"
2025-11-20T11:10:17.791955Z DEBUG vector::app: Building runtime. worker_threads=22
2025-11-20T11:10:17.792033Z TRACE mio::poll: registering event source with poller: token=Token(1), interests=READABLE
2025-11-20T11:10:17.795341Z  INFO vector::app: Loading configs. paths=["/etc/vector/vector-remote.yml", "/etc/vector/vector.yml"]
2025-11-20T11:10:17.796125Z DEBUG vector::config::loading: No secret placeholder found, skipping secret resolution.
2025-11-20T11:10:17.799157Z  WARN vector::config::loading: Transform "enriched_logs" has no consumers
2025-11-20T11:10:17.799231Z DEBUG vector::topology::builder: Building new source. component_id=docker_logs
2025-11-20T11:10:17.799916Z  INFO source{component_kind="source" component_id=docker_logs component_type=docker_logs}: vector::sources::docker_logs: Capturing logs from now on. now=2025-11-20T11:10:17.799858939+00:00
2025-11-20T11:10:17.800007Z TRACE source{component_kind="source" component_id=docker_logs component_type=docker_logs}: bollard::uri: pairs: REDACTED
2025-11-20T11:10:17.800039Z TRACE source{component_kind="source" component_id=docker_logs component_type=docker_logs}: log: Internal log REDACTED
2025-11-20T11:10:17.800117Z DEBUG source{component_kind="source" component_id=docker_logs component_type=docker_logs}: bollard::docker: unix://2f7661722f72756e2f646f636b65722e736f636b/events?since=1763637017&filters=REDACTED
2025-11-20T11:10:17.800164Z  INFO source{component_kind="source" component_id=docker_logs component_type=docker_logs}: vector::sources::docker_logs: Listening to docker log events.
2025-11-20T11:10:17.800188Z DEBUG vector::topology::builder: Building new source. component_id=prom_metrics
2025-11-20T11:10:17.801573Z DEBUG vector::topology::builder: Building new transform. component_id=metrics_as_logs
2025-11-20T11:10:17.801897Z DEBUG vector::topology::builder: Building new transform. component_id=enriched_logs
2025-11-20T11:10:17.804520Z DEBUG vector::topology::builder: Building new transform. component_id=enriched_prom_metrics
2025-11-20T11:10:17.804665Z DEBUG vector::topology::builder: Building new sink. component_id=cloud_hub_metrics
2025-11-20T11:10:17.804873Z DEBUG async_nats::connector: connecting to server attempt=0
2025-11-20T11:10:17.804946Z DEBUG async_nats::connector: attempting connection attempt=1 server=ServerAddr(Url { scheme: "ws", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("cloud-broker")), port: Some(8080), path: "/", query: None, fragment: None }) delay_ms=0
2025-11-20T11:10:17.805397Z  INFO vector::topology::running: Running healthchecks.
2025-11-20T11:10:17.805428Z DEBUG vector::topology::running: Connecting changed/added component(s).
2025-11-20T11:10:17.805449Z DEBUG vector::topology::running: Configuring outputs for source. component_id=docker_logs
2025-11-20T11:10:17.805462Z DEBUG vector::topology::running: Configuring output for component. component_id=docker_logs output_id=None
2025-11-20T11:10:17.805467Z DEBUG vector::topology::running: Configuring outputs for source. component_id=prom_metrics
2025-11-20T11:10:17.805471Z DEBUG vector::topology::running: Configuring output for component. component_id=prom_metrics output_id=None
2025-11-20T11:10:17.805476Z DEBUG vector::topology::running: Configuring outputs for transform. component_id=enriched_prom_metrics
2025-11-20T11:10:17.805479Z DEBUG vector::topology::running: Configuring output for component. component_id=enriched_prom_metrics output_id=None
2025-11-20T11:10:17.805490Z DEBUG vector::topology::running: Configuring outputs for transform. component_id=enriched_logs
2025-11-20T11:10:17.805493Z DEBUG vector::topology::running: Configuring output for component. component_id=enriched_logs output_id=None
2025-11-20T11:10:17.805492Z DEBUG async_nats: retry on initial connect failure is disabled
2025-11-20T11:10:17.805527Z DEBUG async_nats::connector: Internal log [connecting to server] is being suppressed to avoid flooding.
2025-11-20T11:10:17.805496Z DEBUG vector::topology::running: Configuring outputs for transform. component_id=metrics_as_logs
2025-11-20T11:10:17.805550Z DEBUG async_nats::connector: Internal log [attempting connection] is being suppressed to avoid flooding.
2025-11-20T11:10:17.805551Z DEBUG vector::topology::running: Configuring output for component. component_id=metrics_as_logs output_id=None
2025-11-20T11:10:17.805586Z DEBUG vector::topology::running: Connecting inputs for transform. component_id=enriched_prom_metrics
2025-11-20T11:10:17.805597Z DEBUG vector::topology::running: Adding component input to fanout. component_id=enriched_prom_metrics fanout_id=prom_metrics
2025-11-20T11:10:17.805603Z DEBUG vector::topology::running: Connecting inputs for transform. component_id=enriched_logs
2025-11-20T11:10:17.805608Z DEBUG vector::topology::running: Adding component input to fanout. component_id=enriched_logs fanout_id=docker_logs
2025-11-20T11:10:17.805613Z DEBUG vector::topology::running: Connecting inputs for transform. component_id=metrics_as_logs
2025-11-20T11:10:17.805619Z DEBUG vector::topology::running: Adding component input to fanout. component_id=metrics_as_logs fanout_id=enriched_prom_metrics
2025-11-20T11:10:17.805623Z DEBUG vector::topology::running: Connecting inputs for sink. component_id=cloud_hub_metrics
2025-11-20T11:10:17.805629Z DEBUG vector::topology::running: Adding component input to fanout. component_id=cloud_hub_metrics fanout_id=metrics_as_logs
2025-11-20T11:10:17.805645Z DEBUG vector::topology::running: Spawning new source. component_id=docker_logs
2025-11-20T11:10:17.805676Z DEBUG vector::topology::running: Spawning new source. component_id=prom_metrics
2025-11-20T11:10:17.805685Z DEBUG vector::topology::running: Spawning new transform. component_id=enriched_prom_metrics
2025-11-20T11:10:17.805696Z DEBUG vector::topology::running: Spawning new transform. component_id=enriched_logs
2025-11-20T11:10:17.805705Z DEBUG vector::topology::running: Spawning new transform. component_id=metrics_as_logs
2025-11-20T11:10:17.805711Z TRACE vector::topology::running: Spawning new sink. component_id=cloud_hub_metrics
2025-11-20T11:10:17.805753Z  INFO vector: Vector has started. debug="false" version="0.51.1" arch="x86_64" revision="44c8f1c 2025-11-13 15:16:05.303418529"
2025-11-20T11:10:17.805796Z DEBUG source{component_kind="source" component_id=docker_logs component_type=docker_logs}: vector::topology::builder: Source starting.
2025-11-20T11:10:17.805835Z DEBUG source{component_kind="source" component_id=docker_logs component_type=docker_logs}: vector::topology::builder: Source pump supervisor starting.
2025-11-20T11:10:17.805859Z DEBUG source{component_kind="source" component_id=docker_logs component_type=docker_logs}: log: Internal log [unix://2f7661722f72756e2f646f636b65722e736f636b/events?since=1763637017&filters=REDACTED] is being suppressed to avoid flooding.
2025-11-20T11:10:17.805899Z DEBUG source{component_kind="source" component_id=docker_logs component_type=docker_logs}: vector::topology::builder: Source pump starting.
2025-11-20T11:10:17.805857Z DEBUG source{component_kind="source" component_id=prom_metrics component_type=prometheus_scrape}: vector::topology::builder: Source pump supervisor starting.
2025-11-20T11:10:17.805869Z DEBUG source{component_kind="source" component_id=prom_metrics component_type=prometheus_scrape}: vector::topology::builder: Source starting.
2025-11-20T11:10:17.805910Z DEBUG transform{component_kind="transform" component_id=enriched_logs component_type=remap}: vector::topology::builder: Synchronous transform starting.
2025-11-20T11:10:17.805920Z DEBUG transform{component_kind="transform" component_id=enriched_prom_metrics component_type=remap}: vector::topology::builder: Synchronous transform starting.
2025-11-20T11:10:17.805973Z DEBUG transform{component_kind="transform" component_id=metrics_as_logs component_type=metric_to_log}: vector::topology::builder: Synchronous transform starting.
2025-11-20T11:10:17.805975Z DEBUG sink{component_kind="sink" component_id=cloud_hub_metrics component_type=nats}: vector::topology::builder: Sink starting.
2025-11-20T11:10:17.806027Z DEBUG source{component_kind="source" component_id=prom_metrics component_type=prometheus_scrape}: vector::topology::builder: Source pump starting.
2025-11-20T11:10:17.806195Z TRACE vector: Beep.
2025-11-20T11:10:17.806234Z TRACE source{component_kind="source" component_id=docker_logs component_type=docker_logs}: hyper_util::client::legacy::client: http1 handshake complete, spawning background dispatcher task
2025-11-20T11:10:17.807043Z DEBUG async_nats::connector: establishing connection socket_addr=172.20.0.4:8080 tls_required=false
2025-11-20T11:10:17.807109Z DEBUG async_nats::connector: Internal log [establishing connection] is being suppressed to avoid flooding.
2025-11-20T11:10:17.807654Z TRACE log: Internal log [registering event source with poller: token=Token(1), interests=READABLE] is being suppressed to avoid flooding.
2025-11-20T11:10:17.807819Z TRACE async_nats::connection: read operation pending
2025-11-20T11:10:17.807950Z TRACE async_nats::connection: Internal log [read operation pending] is being suppressed to avoid flooding.
2025-11-20T11:10:17.809093Z ERROR vector::internal_events::socket: Error binding socket. error=error creating server listener: Address already in use (os error 98) error_code="socket_bind" error_type="io_failed" stage="initializing" mode=tcp
2025-11-20T11:10:17.809196Z ERROR vector::app: An error occurred that Vector couldn't handle. error=error creating server listener: Address already in use (os error 98) internal_log_rate_limit=false
2025-11-20T11:10:17.809231Z  INFO vector: Vector has stopped.
2025-11-20T11:10:17.809549Z DEBUG source{component_kind="source" component_id=docker_logs component_type=docker_logs}: vector::topology::builder: Source finished normally.
2025-11-20T11:10:17.809595Z DEBUG source{component_kind="source" component_id=docker_logs component_type=docker_logs}: vector::topology::builder: Source pump finished normally.
2025-11-20T11:10:17.809617Z DEBUG source{component_kind="source" component_id=docker_logs component_type=docker_logs}: vector::topology::builder: Source pump supervisor task finished normally.
2025-11-20T11:10:17.810041Z DEBUG sink{component_kind="sink" component_id=cloud_hub_metrics component_type=nats}: vector::utilization: Couldn't send utilization start wait message. component_id=ComponentKey { id: "cloud_hub_metrics" } error="Closed(..)"
2025-11-20T11:10:17.810067Z DEBUG transform{component_kind="transform" component_id=enriched_logs component_type=remap}: vector::topology::builder: Synchronous transform finished normally.
2025-11-20T11:10:17.811143Z  INFO vector::topology::running: Shutting down... Waiting on running components. remaining_components="cloud_hub_metrics, enriched_prom_metrics, prom_metrics, metrics_as_logs" time_remaining="59 seconds left"
2025-11-20T11:10:17.812053Z DEBUG source{component_kind="source" component_id=prom_metrics component_type=prometheus_scrape}: vector_core::tls::settings: Fetching system root certs.
2025-11-20T11:10:17.817009Z DEBUG source{component_kind="source" component_id=prom_metrics component_type=prometheus_scrape}: vector_core::tls::settings: Internal log [Fetching system root certs.] is being suppressed to avoid flooding.
2025-11-20T11:10:17.821474Z DEBUG source{component_kind="source" component_id=prom_metrics component_type=prometheus_scrape}: vector::sources::util::http_client: Finished sending.
2025-11-20T11:10:17.821965Z DEBUG source{component_kind="source" component_id=prom_metrics component_type=prometheus_scrape}: vector::topology::builder: Source finished normally.
2025-11-20T11:10:17.822001Z DEBUG source{component_kind="source" component_id=prom_metrics component_type=prometheus_scrape}: vector::topology::builder: Source pump finished normally.
2025-11-20T11:10:17.822057Z DEBUG source{component_kind="source" component_id=prom_metrics component_type=prometheus_scrape}: vector::topology::builder: Source pump supervisor task finished normally.
2025-11-20T11:10:17.822110Z DEBUG transform{component_kind="transform" component_id=enriched_prom_metrics component_type=remap}: vector::topology::builder: Synchronous transform finished normally.
2025-11-20T11:10:17.822156Z DEBUG transform{component_kind="transform" component_id=metrics_as_logs component_type=metric_to_log}: vector::topology::builder: Synchronous transform finished normally.
2025-11-20T11:10:17.822192Z DEBUG sink{component_kind="sink" component_id=cloud_hub_metrics component_type=nats}: vector::utilization: Internal log [Couldn't send utilization start wait message.] is being suppressed to avoid flooding.
2025-11-20T11:10:17.822210Z DEBUG sink{component_kind="sink" component_id=cloud_hub_metrics component_type=nats}: vector::utilization: Couldn't send utilization stop wait message. component_id=ComponentKey { id: "cloud_hub_metrics" } error="Closed(..)"
2025-11-20T11:10:17.822240Z DEBUG sink{component_kind="sink" component_id=cloud_hub_metrics component_type=nats}: vector::topology::builder: Sink finished normally.

Example Data

No response

Additional Context

Currently this is running in docker compose

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugA code related bug.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions