Cannot read properties of undefined (reading 'mediaFilesSelector')

Rory Aherne asked on September 26, 2023 11:38

Hi, I upgraded to the latest hotfix (v13.0.124) and I've been getting the error Cannot read properties of undefined (reading 'mediaFilesSelector') when trying to edit a widget.

Digging into the debugger the function called is as follows:

(function () {
    const filesData = "[]";
    if (document.readyState === "loading") {
        document.addEventListener("DOMContentLoaded", function () {
            window.kentico._modalDialog.mediaFilesSelector.init("kentico-form_BackgroundImages_Value_component", filesData);
        });
    } else {
        window.kentico._modalDialog.mediaFilesSelector.init("kentico-form_BackgroundImages_Value_component", filesData);
    }
})();

The debugger shows it should be window.kentico.modalDialog:

Image Text

IS there some sort of script building needs to be done on the Admin project after the hotfix is applied?

Correct Answer

Rory Aherne answered on September 27, 2023 15:03

Solution:

I had changed my ASPNETCORE_ENVIRONMENT to "Staging" which then required webBuilder.UseStaticWebAssets(); in Program.cs

0 votesVote for this answer Unmark Correct answer

Recent Answers


Juraj Ondrus answered on September 26, 2023 13:08

Have you tried restoring backups and applying hotfix again? Were the NuGet packages in the front end app also updated to match the hotfix version? Have you tried clearing the browser cache? What other troubleshooting have you tried?

0 votesVote for this answer Mark as a Correct answer

Rory Aherne answered on September 27, 2023 11:19

Hi Juraj, I've tried all of the above, restarting application pools, different browsers in different environments. You say nuget packages but the hotfix instructions only mention 1 (Kentico.Xperience.AspNetCore.WebApp). Are there other packages I should be updating?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 27, 2023 11:38

You did not mentioned what development model are you using and e.g. in the MVC development model there are more packages. Also, you may be using the the Libraries packages. I do not know your project. The hotfix instructions mention just the minimum, out of the box things.
Are you able to reproduce the issue using the Dancing goat Core project? So we have the same code base and we can take a further look. Otherwise it is possible that there is some customization breaking the scripts.

0 votesVote for this answer Mark as a Correct answer

Rory Aherne answered on September 27, 2023 12:48

Yes you are correct, it must be something custom I have breaking the scripts

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.