GithubHelp home page GithubHelp logo

botconnectorapi's People

Contributors

kokkoon avatar

Stargazers

Manohar Palanisamy avatar  avatar Hugo Morillo avatar

Watchers

 avatar Manohar Palanisamy avatar  avatar

botconnectorapi's Issues

NullReferenceException: Object reference not set to an instance of an object

I was following the following Twillio blog to connect Power Virtual Agents (PVA) bots to Twilio using a Relay Bot in C# (link).

I cloned this project as mentioned in the blog, where I proceeded to update the parameters to the appSettings.json file with the values collected from the PVA bot.

I then ran the C# project using the dotnet watch run from within the project folder in my terminal. This loaded up a Swagger page on http://localhost:5157/swagger/index.html, which I then used to test the relay bot.

After filling in the From and Body parameters in the request, I executed the API request, which failed.

Here is the error log from the terminal:

Please note that I have changed the from number to something random, but in the actual request, I did put in the correct Twilio phone number.

From: +19999999999, hi
s_tokens: eyJhbGciOiJSUzI1NiIsImtpZCI6Ii1FMmRMMlhXZ2tCSTNmLV93MTNrWUE0YXBXTSIsIng1dCI6Ii1FMmRMMlhXZ2tCSTNmLV93MTNrWUE0YXBXTSIsInR5cCI6IkpXVCJ9.eyJib3QiOiJmOWFkYzJiZC01YmZjLTRiNWUtYTA3Zi1kYzY4OTdjMDQ1YmQiLCJzaXRlIjoiSEp6eE1STjBTcGciLCJjb252IjoiNFRTRHNxWUlGZHEzT0FaRFRCOXdMei1ldSIsInVzZXIiOiIyOTNkZGNiMi0zNzA5LTRlNDItOGNlZS00NTUxNmY3YTFiNDEiLCJuYmYiOjE2ODQzNDczMDksImV4cCI6MTY4NDM1MDkwOSwiaXNzIjoiaHR0cHM6Ly9kaXJlY3RsaW5lLmJvdGZyYW1ld29yay5jb20vIiwiYXVkIjoiaHR0cHM6Ly9kaXJlY3RsaW5lLmJvdGZyYW1ld29yay5jb20vIn0.jYx9HCxOFTYNS68MwIc-XejfiKRQF08zLQMv4RCIIukaSHE-fbljFw8jHjhqgTTmEMCyCxGfOmfa36Kv1kJQ8VXkUluOtReolyONVtMjvozs_1Tyif33CVFKDfW9ef-iyMCVWmOOEi5JO9sPoREASb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iddleware[1]
      An unhandled exception has occurred while executing the request.
      System.NullReferenceException: Object reference not set to an instance of an object.
         at myBotConnector.Controllers.BotConnectorController.StartConversation(String inputMsg, String token) in C:\Users\rawatsid\Documents\BotConnectorAPI\Controllers\myBotConnectorController.cs:line 67
         at myBotConnector.Controllers.BotConnectorController.StartBot(String From, String Body) in C:\Users\rawatsid\Documents\BotConnectorAPI\Controllers\myBotConnectorController.cs:line 55
         at lambda_method5(Closure, Object)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
         at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
         at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
         at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

If I'm not wrong, the above error points to the myBotConnectorController.cs file, at line 67:

    private async Task<string> StartConversation(string inputMsg, string token)
    {
        Console.WriteLine("token: " + token);
        using (var directLineClient = new DirectLineClient(token))
        {
            var conversation = await directLineClient.Conversations.StartConversationAsync();
            var conversationtId = conversation.ConversationId;//FAIL HERE

I'm unable to debug what could be the possible problem here. Any idea as to what might be causing this problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.