fix: disable incremental sync for Companies and Resources
Companies and Resources entities in Autotask API do not support date-based filtering for incremental syncs. When attempting incremental sync, Autotask returns errors: - Companies: 'Unable to find lastTrackedModificationDateTime' - Resources: 'Unable to find lastModifiedDate' Solution: - Skip incremental sync for these entities - Always perform full sync for Companies and Resources - Log informational message when falling back to full sync - Other entities continue to support incremental sync normally This prevents sync failures while maintaining data freshness for Companies and Resources through full syncs.
This commit is contained in:
parent
43e8c74074
commit
fc284aba85
1 changed files with 6 additions and 1 deletions
|
|
@ -85,7 +85,10 @@ export class EntitySyncService {
|
|||
let params: any = {};
|
||||
|
||||
// For incremental sync, filter by last sync time
|
||||
if (isIncremental) {
|
||||
// Note: Companies and Resources don't support date-based filtering in Autotask API
|
||||
const supportsIncremental = entity !== EntityType.COMPANIES && entity !== EntityType.RESOURCES;
|
||||
|
||||
if (isIncremental && supportsIncremental) {
|
||||
try {
|
||||
const lastSyncTime = await getLastSyncTime(entity);
|
||||
if (lastSyncTime) {
|
||||
|
|
@ -99,6 +102,8 @@ export class EntitySyncService {
|
|||
entityLogger.error('Failed to get last sync time', {}, err);
|
||||
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, build filters
|
||||
const filters: Array<{ field: string; op: string; value: any }> = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue