Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't retry failed TwilioSendSmsJob with error code 21211 #74

Open
sauloperez opened this issue Nov 5, 2020 · 0 comments
Open

Don't retry failed TwilioSendSmsJob with error code 21211 #74

sauloperez opened this issue Nov 5, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@sauloperez
Copy link
Collaborator

sauloperez commented Nov 5, 2020

Description

We're seeing a substantial number of errors in our error tracking due to exceptions like:

Twilio::REST::RestError Sidekiq/Decidim::ActionDelegator::TwilioSendSmsJob
[HTTP 400] 21211 : Unable to create record The 'To' number 6xxxxxxxx is not a valid phone number. https://www.twilio.com/docs/errors/21211

Admins keep uploading phone numbers without the country prefix (+34) and they are not valid for Twilio. This might be fine but given Sidekiq's retries the count in error tracking is showing an X times greater number than it actually is, while these retries will never work. They use a phone number that's proven to be invalid.

This needs to be solved at UX-level. We might need to make numbers without prefix work, but in the meantime, we shouldn't be wasting resources and messing up with error counts.

Proposed solution

We can make use of ActiveJob's discard_on checking for Twilio's error 21211 checking the RestError object.

@sauloperez sauloperez added the bug Something isn't working label Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant