abp icon indicating copy to clipboard operation
abp copied to clipboard

ProgressiveWebApp integration issue - ServiceProxyScript crashes 500 error

Open kgamalseif opened this issue 6 years ago • 4 comments

Following this link https://blog.elmah.io/turning-an-aspnet-core-website-into-a-progressive-web-app-pwa/ to add PWA feature to MVC template it crashes:

ArgumentNullException: Value cannot be null. (Parameter 'httpMethod') Volo.Abp.Check.NotNull(T value, string parameterName) Volo.Abp.Http.Modeling.ActionApiDescriptionModel.Create(string uniqueName, MethodInfo method, string url, string httpMethod, IList supportedVersions) Portal.Halaqat.Web.Framework.RepAspNetCoreApiDescriptionModelProvider.AddApiDescriptionToModel(ApiDescription apiDescription, ApplicationApiDescriptionModel applicationModel, ApplicationApiDescriptionModelRequestDto input) in RepAspNetCoreApiDescriptionModelProvider.cs + var actionModel = controllerModel.AddAction(uniqueMethodName, ActionApiDescriptionModel.Create( Portal.Halaqat.Web.Framework.RepAspNetCoreApiDescriptionModelProvider.CreateApiModel(ApplicationApiDescriptionModelRequestDto input) in RepAspNetCoreApiDescriptionModelProvider.cs + AddApiDescriptionToModel(apiDescription, model, input);


changed the method CreateApiModel at AspNetCoreApiDescriptionModelProvider solved the problem: `

        var model = ApplicationApiDescriptionModel.Create();

        foreach (var descriptionGroupItem in _descriptionProvider.ApiDescriptionGroups.Items)
        {
            foreach (var apiDescription in descriptionGroupItem.Items)
            {
                if (!apiDescription.ActionDescriptor.IsControllerAction())
                {
                    continue;
                }

                if (apiDescription.HttpMethod.IsNullOrEmpty()) apiDescription.HttpMethod = "GET";

                AddApiDescriptionToModel(apiDescription, model, input);
            }
        }

        return model;`

kgamalseif avatar May 17 '20 03:05 kgamalseif

@maliming can you try to understand this?

hikalkan avatar May 19 '20 23:05 hikalkan

@kgamalseif This is like a third-party library problem, please provide a project to reproduce the problem. You can use cli to create it. https://docs.abp.io/en/abp/latest/CLI

maliming avatar May 20 '20 00:05 maliming

https://github.com/kgamalseif/PwaTest Kindly find the above project. to reproduce the issue, just comment line: if (apiDescription.HttpMethod.IsNullOrEmpty()) apiDescription.HttpMethod = "GET"; at RepAspNetCoreApiDescriptionModelProvider.cs

Thanks, Khaled

kgamalseif avatar May 20 '20 06:05 kgamalseif

hi @kgamalseif
WebEssentials.AspNetCore.ServiceWorker has fixed this problem, but it does not seem to be released to nuget. https://github.com/madskristensen/WebEssentials.AspNetCore.ServiceWorker/pull/62

maliming avatar May 20 '20 09:05 maliming