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?
Summary
The
test-connectioncommand fails for an otherwise-valid PostgreSQL replication configuration before it can report the connection result.test-connectionregisters aReplicationEngine, butTEST_CONNECTIONmode receives no replication metrics.PostgresModulethen installs a pgwire byte recorder that accesses an unregisteredDATA_REPLICATED_BYTEScounter.Environment
sha256:b6b22fa7d0d862f04bdff62846e656756d17bcf3dd6eca399a0633671051438bmainatd3216be9f1f285fd4f2622a7d987ebaf4c2b8e0cReproduction
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.yamlActual result
The command exits nonzero with:
Expected result
The command should complete its PostgreSQL connection and permission checks and report their actual result.
Source trail in v1.24.0
test-connectionselectsTEST_CONNECTIONmode and registersReplicationEngineTEST_CONNECTIONis absent from the metrics-mode mapMetricModes.REPLICATIONDATA_REPLICATED_BYTESwhenever a replication engine existsServiceAssertionErrorImpact
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_CONNECTIONor avoiding the PostgreSQL replication-byte recorder in this mode. Which behavior is intended fortest-connection?