Skip to content

Postgres test-connection fails because replication-byte metric is not registered #751

Description

@crspi

Summary

The test-connection command fails for an otherwise-valid PostgreSQL replication configuration before it can report the connection result.

test-connection registers a ReplicationEngine, but TEST_CONNECTION mode receives no replication metrics. PostgresModule then installs a pgwire byte recorder that accesses an unregistered DATA_REPLICATED_BYTES counter.

Environment

  • Runtime failure reproduced with PowerSync Service v1.23.3, pinned to OCI digest sha256:b6b22fa7d0d862f04bdff62846e656756d17bcf3dd6eca399a0633671051438b
  • PostgreSQL replication source
  • The five causal files are unchanged in stable v1.24.0, prerelease v1.25.0, and current main at d3216be9f1f285fd4f2622a7d987ebaf4c2b8e0c

Reproduction

Use an otherwise-valid self-hosted configuration containing a PostgreSQL replication connection:

docker run --rm \
  -v "$PWD/powersync.yaml:/config/powersync.yaml:ro" \
  journeyapps/powersync-service:1.23.3@sha256:b6b22fa7d0d862f04bdff62846e656756d17bcf3dd6eca399a0633671051438b \
  test-connection --config-path /config/powersync.yaml

Actual result

The command exits nonzero with:

PSYNC_S0001: Counter powersync_data_replicated_bytes_total has not been created and registered yet.

Expected result

The command should complete its PostgreSQL connection and permission checks and report their actual result.

Source trail in v1.24.0

Impact

This makes the service CLI unsuitable as a PostgreSQL readiness or deployment gate, even when the database configuration itself is valid.

Possible fixes appear to be either registering replication metrics for TEST_CONNECTION or avoiding the PostgreSQL replication-byte recorder in this mode. Which behavior is intended for test-connection?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions