twilio-csharp
twilio-csharp copied to clipboard
Verification Check Failed - Requested Resource Not Found (Intermittent Failure)
Issue Summary
This has been reported (and fixed?) on the twilio-node project, however I am experiencing this same issue using v5.52.1 with C# ASP.NET Core 3.1. It appears to be intermittent as only a small percentage of the user base has seen this issue. What's interesting is when it does fail, it will continue to fail 3 total times before working again. During the failures for some users, others continue to complete verification check as expected.
Steps to Reproduce
- Server sends user SMS Verification Check code using Twilio API
- User enters code in UI and submits to server for Verification Check
- Server utilizes simple Verification Check to verify
- Random failure reported below occurs, estimating <5% failure rate
Code Snippet
public async Task<bool> CheckVerification(string toNumber, string code)
{
try
{
TwilioClient.Init(_accountSid, _authToken);
var verification = await VerificationCheckResource.CreateAsync(
to: new Twilio.Types.PhoneNumber(toNumber).ToString(),
code: code,
pathServiceSid: _verificationServiceId
);
_logger.LogInformation($"Verification Check to {toNumber} details: {verification.Status}");
return verification.Status switch
{
"approved" => true,
"pending" => false,
"canceled" => false,
_ => false
};
}
catch (Exception e)
{
_logger.LogError($"Failed to Check Verification Code {code} from SMS Text to {toNumber}! Error: {e}");
return false;
}
}
Exception/Log
Error: Twilio.Exceptions.ApiException: The requested resource /Services/**********************/VerificationCheck was not found
at Twilio.Clients.TwilioRestClient.ProcessResponse(Response response)
at Twilio.Clients.TwilioRestClient.RequestAsync(Request request)
at Twilio.Rest.Verify.V2.Service.VerificationCheckResource.CreateAsync(CreateVerificationCheckOptions options, ITwilioRestClient client)
at Twilio.Rest.Verify.V2.Service.VerificationCheckResource.CreateAsync(String pathServiceSid, String code, String to, String verificationSid, String amount, String payee, ITwilioRestClient client)
Technical details:
- twilio-csharp version: 5.52.1
- twilio-aspnet version: 5.37.2
- csharp version: 8.0, .NET Core 3.1.10
Hello @periapsistech,
What namespace are you using? Should be using Twilio.Rest.Verify.V2.Service; (example).
With best regards,
Elmer
Thanks for the reply, @thinkingserious. Here's what I have:
using Twilio.Exceptions;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Rest.Lookups.V1;
using Twilio.Rest.Verify.V2.Service;
Hello @periapsistech,
Based on the intermittent nature of the issue, it appears the issue maybe downstream. In order to properly debug this issue, could you please file a support ticket here. Feel free to circle back and re-open if it is determined there is indeed an issue with the latest version of this library.
Thank you!
With best regards,
Elmer
@thinkingserious Thanks! Will do..
I have this exact same issue, it fails every time for me.
Hi @periapsistech and @darrynhoskingluna
Please check this doc, this addresses the same exception/error you are getting. Please update if this resolves your issue.