twilio-csharp icon indicating copy to clipboard operation
twilio-csharp copied to clipboard

Verification Check Failed - Requested Resource Not Found (Intermittent Failure)

Open periapsistech opened this issue 4 years ago • 6 comments

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

  1. Server sends user SMS Verification Check code using Twilio API
  2. User enters code in UI and submits to server for Verification Check
  3. Server utilizes simple Verification Check to verify
  4. 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

periapsistech avatar Jan 11 '21 14:01 periapsistech

Hello @periapsistech,

What namespace are you using? Should be using Twilio.Rest.Verify.V2.Service; (example).

With best regards,

Elmer

thinkingserious avatar Jan 12 '21 01:01 thinkingserious

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;

periapsistech avatar Jan 12 '21 01:01 periapsistech

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 avatar Jan 19 '21 23:01 thinkingserious

@thinkingserious Thanks! Will do..

periapsistech avatar Jan 19 '21 23:01 periapsistech

I have this exact same issue, it fails every time for me.

darrynhoskingluna avatar Oct 17 '21 07:10 darrynhoskingluna

Hi @periapsistech and @darrynhoskingluna

Please check this doc, this addresses the same exception/error you are getting. Please update if this resolves your issue.

isha689 avatar Sep 22 '22 06:09 isha689