Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strict-mode does not allow duplicate property names in log file #14

Closed
bjarnef opened this issue Nov 10, 2021 · 7 comments
Closed

Strict-mode does not allow duplicate property names in log file #14

bjarnef opened this issue Nov 10, 2021 · 7 comments
Labels
bug Something isn't working

Comments

@bjarnef
Copy link
Contributor

bjarnef commented Nov 10, 2021

Not sure if this is an issue with the map plugin or because it use Smidge to bundle assets, but I noticed these log errors on an Umbraco Cloud project I am working on.

image

System.InvalidOperationException: /App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(35,19-20): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(36,25-26): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(37,19-20): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(38,21-22): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(39,21-22): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(40,13-14): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(41,28-29): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(47,17-18): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(48,16-17): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(49,16-17): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(50,15-16): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(51,16-17): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(52,15-16): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(53,17-18): run-time error JS1292: Strict-mode does not allow duplicate property names: =,/App_Plugins/Bergmania.OpenStreetMap/lib/autocomplete/js/autocomplete.js(54,22-23): run-time error JS1292: Strict-mode does not allow duplicate property names: =
   at Smidge.Nuglify.NuglifyJs.ProcessAsync(FileProcessContext fileProcessContext, PreProcessorDelegate next)
   at Smidge.FileProcessors.PreProcessPipeline.ProcessNext(Queue`1 queue, FileProcessContext fileProcessContext)
   at Smidge.FileProcessors.PreProcessPipeline.ProcessAsync(FileProcessContext fileProcessContext)
   at Smidge.FileProcessors.PreProcessManager.ProcessFileImpl(IWebFile file, BundleOptions bundleOptions, BundleContext bundleContext)
   at Smidge.FileProcessors.PreProcessManager.ProcessFile(IWebFile file, BundleOptions bundleOptions, BundleContext bundleContext)
   at Smidge.FileProcessors.PreProcessManager.ProcessAndCacheFileAsync(IWebFile file, BundleOptions bundleOptions, BundleContext bundleContext)
   at Smidge.Controllers.SmidgeController.Bundle(BundleRequestModel bundleModel)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(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|24_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|19_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.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Umbraco.Cms.Web.Common.Middleware.BasicAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Umbraco.Cms.Web.BackOffice.Middleware.BackOfficeExternalLoginProviderErrorMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Builder.Extensions.MapMiddleware.Invoke(HttpContext context)
   at Umbraco.Deploy.Infrastructure.Middleware.BearerTokenAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Diagnostics.StatusCodePagesMiddleware.Invoke(HttpContext context)
   at StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in C:\projects\dotnet\src\MiniProfiler.AspNetCore\MiniProfilerMiddleware.cs:line 121
   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()
@bjarnef
Copy link
Contributor Author

bjarnef commented Nov 10, 2021

It seems Smidge has a dependency on NUglify, which has this error message:
https://github.com/trullock/NUglify/blob/master/src/NUglify/JavaScript/JSError.cs#L96

@bjarnef
Copy link
Contributor Author

bjarnef commented Nov 12, 2021

Maybe it doesn't support newer JS syntax.

There are some other formats here we could include instead:
https://github.com/tomik23/autocomplete/tree/master/dist/js

@bjarnef
Copy link
Contributor Author

bjarnef commented Nov 14, 2021

@bergmania okay, it seems the changes in v3.3.0 affect the bundling/minifying in production, which caused some other controllers not being registered, e.g. these controllers used for custom block views:

chrome_FL6XF7usgU

Locally it did work though.

I reverted back to v3.2.0 and everything in working on production again.

Could we try using one of the alternative versions instead: https://github.com/tomik23/autocomplete/tree/master/dist/js

@creativesuspects
Copy link
Contributor

I was having the same issue after upgrading to 3.3.0. The Smidge.Nuglify error broke parts of the backoffice (e.g. block list editor). I also had to revert back to 3.2.0 to resolve the issue.

@bergmania bergmania added the bug Something isn't working label Nov 19, 2021
@bergmania
Copy link
Owner

Looks like we can just use the pre-minified version

@bergmania
Copy link
Owner

Fixed in 3.3.1

@bjarnef
Copy link
Contributor Author

bjarnef commented Nov 19, 2021

Not sure it should include the minified version. Doesn't Smidge already minify the assets?
So in debug mode it may be easier debug in browser if you needed to,

I think the main issues is that the JS asset was compiled using iife, but now use umd, but also contain a esm version.
https://github.com/tomik23/autocomplete/tree/master/dist/js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants