Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Davide Da Ronco 3 posts 83 karma points
    Apr 26, 2023 @ 12:57
    Davide Da Ronco
    0

    Custom Recipient Provider empty list

    Hi,

    I'm trying to implement a custom recipient provider using the example code in the documentation, but when I select the demo provider in the workspace settings I encounter some issues.

    The Campaigns-section doesn't show any existent campaign: the API call to GetOverview returns the code 500, clicking on the sub-sections returns the same code for the GetPagedCampaignListItems call or a "Cannot set properties of undefined" error. When sending the campaign the recipient selection section is empty (as in the image below), with the API call to GetRecipientLists returning the code 500.

    In a newly created project the first issue doesn't arise, but the second is still present. Deselecting the demo provider everything returns normal.

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Apr 27, 2023 @ 07:51
    Markus Johansson
    0

    Hi!

    Sorry to hear that you're having issues with the custom provider.

    I'm assuming that you've followed the information here https://www.newsletterstudio.org/documentation/package/4.0.0/develop/recipient-list-providers/ ?

    Do you see any errors in the Umbraco Log?

    Is there a more detailed error message in the 500-response for the API-calls?

    I would also recommend that you set breakpoints in your custom provider code and step over each line to see if something blows up inside the new provider.

    // m

  • Davide Da Ronco 3 posts 83 karma points
    Apr 27, 2023 @ 10:06
    Davide Da Ronco
    0

    Hi Markus,

    Yes, I'm following the example in the link you posted.

    Unfortunately in the Umbraco Log there is nothing helpful.

    Reagarding the breakpoints the only lines executed are

    public string DisplayName => "Demo Provider";
    public string DisplayNameLocalizationKey => "site_demoProvider";
    

    The response of the API-calls is always

    {
    "ExceptionMessage": "Index was outside the bounds of the array.",
    "ExceptionType": "System.IndexOutOfRangeException, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e",
    "StackTrace": "   at NewsletterStudio.Web.Services.TranslateService.Localize(String key)\r\n   at NewsletterStudio.Core.Extensions.ITranslateServiceExtensions.Localize(ITranslateService service, String localizationKey, Action`1 action)\r\n   at NewsletterStudio.Core.Services.RecipientListProviderService.GetAllLists(Guid workspaceKey)\r\n   at NewsletterStudio.Core.Frontend.Campaign.CampaignControllerActions.GetRecipientLists(Guid workspaceKey)\r\n   at lambda_method1114(Closure, Object, Object[])\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"
    }
    

    except for when I click on the Draft or Scheduled sections: in that case before thew API-call it triggers this error and doesn't send the POST-request

    TypeError: Cannot set properties of undefined (setting 'campaigns')
    at newsletterstudio.typed.min.js?d=638181097450000000:1:24652
    at angular.js:18075:37
    at m.$digest (angular.js:19242:15)
    at m.$apply (angular.js:19630:13)
    at k (angular.js:13473:36)
    at v (angular.js:13730:7)
    at y.onload (angular.js:13635:9) 'Possibly unhandled rejection: {}'
    
  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Apr 27, 2023 @ 12:04
    Markus Johansson
    100

    Hi!

    Thanks for sharing the details!

    "StackTrace": "   at NewsletterStudio.Web.Services.TranslateService.Localize(String key)\r\n   
    at NewsletterStudio.Core.Extensions.ITranslateServiceExtensions.Localize(ITranslateService service, String localizationKey, Action`1 action)\r\n   
    at NewsletterStudio.Core.Services.RecipientListProviderService.GetAllLists(Guid workspaceKey)\r\n   
    at NewsletterStudio.Core.Frontend.Campaign.CampaignControllerActions.GetRecipientLists(Guid workspaceKey)\r\n  
     at lambda_method1114(Closure, Object, Object[])\r\n   
    at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)\r\n   
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)\r\n   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)\r\n   
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)\r\n   
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)\r\n   
    at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n--- End of stack trace from previous location ---\r\n   
    at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)"
    }
    

    Looks like there is a bug when we try to get the translation for the provider name. This might sound strange but please give these things a try:

    Change the DisplayNameLocalizationKey to something that contains a "slash" eg like this: "site/demoProvider"

    Does that make any difference?

    // m

  • Davide Da Ronco 3 posts 83 karma points
    Apr 27, 2023 @ 12:53
    Davide Da Ronco
    0

    Now everything works!

    Maybe would be better to fix the example to save other people from the same confusion I had...

    Nonetheless thank you for your quick help!

  • Markus Johansson 1936 posts 5864 karma points MVP 2x c-trib
    Apr 27, 2023 @ 15:03
    Markus Johansson
    0

    Hi!

    Thanks for letting me know!

    I've added the bug to the backlog for fixing and updated the docs.

    Sorry about the inconvenience.

    Please feel free to reach out if you have other issues, questions, or feedback!

    All the best!

Please Sign in or register to post replies

Write your reply to:

Draft