Stand-With-Crypto / swc-web

Stand With Crypto's codebase, open sourced for community collaboration. If you care about crypto, it's time to prove it.
https://www.standwithcrypto.org/
Apache License 2.0
20 stars 4 forks source link

Don't retry addresses that has error not related to api issues on usCongressionalDistrict backfill #1234

Closed sentry-io[bot] closed 1 week ago

sentry-io[bot] commented 3 weeks ago

Sentry Issue: PROD-SWC-WEB-1HP

Error: 400 from GET https://www.googleapis.com/civicinfo/v2/representatives with json response
  File "swc-web/./src/utils/shared/fetchReq.ts", line 71, in c
    scope.setTransactionName(errorName)
  File "swc-web/./src/utils/shared/googleCivicInfo.ts", line 129, in result
    const CIVIC_BY_ADDRESS_ENDPOINT = 'https://www.googleapis.com/civicinfo/v2/representatives'
  File "swc-web/./src/utils/shared/getCongressionalDistrictFromAddress.ts", line 83, in maybeGetCongressionalDistrictFromAddress
    return { notFoundReason: 'USER_WITHOUT_ADDRESS' as const }
  File "swc-web/./src/inngest/functions/backfillCongressionalDistrictCronJob/index.ts", line 108, in backfillUsCongressionalDistricts
    domain: 'backfillUsCongressionalDistricts',
  File "swc-web/./src/inngest/functions/backfillCongressionalDistrictCronJob/index.ts", line 76, in _a
    `Finished backfilling batch ${i} of ${numBatches} maximum batches of addresses without usCongressionalDistrict`,
...
(5 additional frame(s) were not displayed)
mhamendes commented 3 weeks ago

We should save add empty string or something similar on usCongressionalDistrict for addresses that causes errors not equal to CIVIC_API_DOWN, UNEXPECTED_ERROR and CIVIC_API_QUOTA_LIMIT_REACHED when querying the civic api so it won't be retried on later cron job runs. This event for example caused a 400 error because the addresses formatted description is an email, this should not be retried at all because it will always cause a 400 error.