diff --git a/packages/integration-handler/src/index.ts b/packages/integration-handler/src/index.ts index bb27136cd..30de57935 100644 --- a/packages/integration-handler/src/index.ts +++ b/packages/integration-handler/src/index.ts @@ -251,33 +251,33 @@ export const importer = Sentry.GCPFunction.wrapHttpFunction( total: offset, size: retrievedData.length, }) - - console.log('updating integration...', { - userId, - integrationId: req.body.integrationId, - syncedAt, - }) - // update the integration's syncedAt and remove taskName - const result = await updateIntegration( - REST_BACKEND_ENDPOINT, - req.body.integrationId, - new Date(syncedAt), - req.body.integrationName, - claims.token, - token, - 'IMPORT', - null - ) - if (!result) { - console.error('failed to update integration', { - userId, - integrationId: req.body.integrationId, - }) - return res.status(400).send('Failed to update integration') - } } while (retrievedData.length > 0 && offset < 20000) // limit to 20k pages } + console.log('updating integration...', { + userId, + integrationId: req.body.integrationId, + syncedAt, + }) + // update the integration's syncedAt and remove taskName + const result = await updateIntegration( + REST_BACKEND_ENDPOINT, + req.body.integrationId, + new Date(syncedAt), + req.body.integrationName, + claims.token, + token, + 'IMPORT', + null + ) + if (!result) { + console.error('failed to update integration', { + userId, + integrationId: req.body.integrationId, + }) + return res.status(500).send('Failed to update integration') + } + console.log('done') } catch (err) { console.error('import pages from integration failed', {