diff --git a/connectors/src/connectors/notion/temporal/activities.ts b/connectors/src/connectors/notion/temporal/activities.ts index 383122a3650a..ddbeca0a270c 100644 --- a/connectors/src/connectors/notion/temporal/activities.ts +++ b/connectors/src/connectors/notion/temporal/activities.ts @@ -1354,7 +1354,16 @@ export async function cacheBlockChildren({ }, }); - if (notionPageModel?.skipReason) { + if (!notionPageModel) { + logger.info("Skipping page not found in db."); + return { + nextCursor: null, + blocksWithChildren: [], + blocksCount: 0, + }; + } + + if (notionPageModel.skipReason) { logger.info( { skipReason: notionPageModel.skipReason }, "Skipping page with skip reason"