slco-2016 / clientcomm

A communications platform for case managers in the Criminal Justice System.
https://clientcomm.org/
Other
10 stars 3 forks source link

Twilio error log stored on S3 as attachment content on voice. #208

Open kuanb opened 7 years ago

kuanb commented 7 years ago

Voice message was left for case manager and appears to have been successfully transcribed. But when "view message" is clicked on the messages stream to view/listen to the message, the Twilio XML error is rendered instead. Refer to @maxmcd about this.

kuanb commented 7 years ago

What the response looked like:

<TwilioResponse>
<RestException>
<Code>20404</Code>
<Message>
The requested resource /2010-04-01/Accounts/AC12d7cd4e8a2e993ac0e8d95c60357360/Recordings/RE519202e841057e50b90c4e6cb96b0630 was not found
</Message>
<MoreInfo>https://www.twilio.com/docs/errors/20404</MoreInfo>
<Status>404</Status>
</RestException>
</TwilioResponse>
kuanb commented 7 years ago

Original audio link (though it has since expired so access would be denied if used now):

https://clientcomm-attachments.s3.amazonaws.com/0ry23u5nrgkrxiveipb9-RE519202e841057e50b90c4e6cb96b0630?AWSAccessKeyId=AKIAJ6NSYYRMEJ3SDGPA&Expires=1477001741&Signature=ABz1epGt0JSot1t%2FKe7tEbASdJc%3D

kuanb commented 7 years ago

Temporary solution: Store logs better.

In save() in voiceController: console.log('Recording save req body from Twilio\n', req.body); was added in commit 1553f94..da6c3d7.

kuanb commented 7 years ago

Proposed action: Pair with another developer to better understand problem. Review all Twilio errors occurring.

tmaybe commented 7 years ago

Saw this again on the Multnomah deploy today.

tdooner commented 7 years ago

I think this is a race condition with the twilio API, perhaps implementing a retry after a few seconds before uploading an XML document to S3 would be a good idea.