Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/olive-spoons-stare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@powersync/service-core': patch
---

Moved tag variable initialization in diagnostics route to ensure it is initialized before usage
9 changes: 5 additions & 4 deletions packages/service-core/src/api/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ export async function getSyncRulesStatus(
};
}

const sourceConfig = await apiHandler.getSourceConfig();
// This method can run under some situations if no connection is configured yet.
// It will return a default tag in such a case. This default tag is not module specific.
const tag = sourceConfig.tag ?? DEFAULT_TAG;
const systemStorage = live_status ? bucketStorage.getInstance(sync_rules) : undefined;
const status = await systemStorage?.getStatus();
let replication_lag_bytes: number | undefined = undefined;
Expand Down Expand Up @@ -128,15 +132,12 @@ export async function getSyncRulesStatus(
})
);

const sourceConfig = await apiHandler.getSourceConfig();
const tag = sourceConfig.tag ?? DEFAULT_TAG;

return {
content: include_content ? sync_rules.sync_rules_content : undefined,
connections: [
{
id: sourceConfig.id ?? DEFAULT_DATASOURCE_ID,
tag: sourceConfig.tag ?? DEFAULT_TAG,
tag: tag,
slot_name: sync_rules.slot_name,
initial_replication_done: status?.snapshot_done ?? false,
// TODO: Rename?
Expand Down
Loading