mozmeao/basket

Fix country code handling to CTMS

Closed this issue · 0 comments

https://mozilla.sentry.io/issues/5141542909/events/a6cb34c44f2549288b4eb4ddb9a9ebb0/

AttributeError: 'NoneType' object has no attribute 'strip'
  File "rq/worker.py", line 1431, in perform_job
    rv = job.perform()
  File "rq/job.py", line 1280, in perform
    self._result = self._execute()
  File "rq/job.py", line 1317, in _execute
    result = self.func(*self.args, **self.kwargs)
  File "basket/news/tasks.py", line 143, in fxa_verified
    upsert_contact(SUBSCRIBE, new_data, user_data)
  File "basket/news/tasks.py", line 345, in upsert_contact
    new_user = ctms.add(update_data)
  File "basket/news/backends/ctms.py", line 885, in add
    return self.interface.post_to_create(to_vendor(data))
  File "basket/news/backends/ctms.py", line 298, in to_vendor
    value = processor(raw_value)
  File "basket/news/backends/ctms.py", line 177, in process_country
    country = raw_country.strip().lower()

We can likely check if country has a value first before processing.