fix: ensure Companies and Resources get filters during incremental sync fallback
Fixed critical logic bug where Companies and Resources were not getting proper filters applied when falling back from incremental to full sync. Root Cause: - During scheduled incremental sync, Companies and Resources correctly identify they don't support incremental sync - However, the filter-building logic was in an else block that only executed for non-incremental syncs - This caused Companies and Resources to sync with NO filters at all - Autotask API now rejects queries without filters, returning: 'Value cannot be null. Parameter name: filters' Fix: - Restructured logic so filter building happens for BOTH: 1. Non-incremental (full) syncs 2. Incremental syncs that fall back to full sync - Companies and Resources now get active filters applied even during scheduled incremental syncs This resolves the scheduled sync failures for Companies, Resources, and all other entities that were failing due to the cascading effect of early failures.
This commit is contained in:
parent
8405c813a3
commit
d8e6931b85
1 changed files with 8 additions and 4 deletions
|
|
@ -102,10 +102,14 @@ export class EntitySyncService {
|
||||||
entityLogger.error('Failed to get last sync time', {}, err);
|
entityLogger.error('Failed to get last sync time', {}, err);
|
||||||
throw new Error(`Failed to determine sync time: ${err.message}`);
|
throw new Error(`Failed to determine sync time: ${err.message}`);
|
||||||
}
|
}
|
||||||
} else if (isIncremental && !supportsIncremental) {
|
}
|
||||||
entityLogger.info(`${entity} does not support incremental sync, performing full sync instead`);
|
|
||||||
} else {
|
// For full sync OR entities that don't support incremental, build filters
|
||||||
// For full sync, build filters
|
if (!isIncremental || (isIncremental && !supportsIncremental)) {
|
||||||
|
if (isIncremental && !supportsIncremental) {
|
||||||
|
entityLogger.info(`${entity} does not support incremental sync, performing full sync instead`);
|
||||||
|
}
|
||||||
|
|
||||||
const filters: Array<{ field: string; op: string; value: any }> = [];
|
const filters: Array<{ field: string; op: string; value: any }> = [];
|
||||||
|
|
||||||
// Special handling for entities that require filters
|
// Special handling for entities that require filters
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue