Media Files Selector not loading in page builder

Danny Winbourne asked on February 20, 2024 18:11

I have a simple property on my widget:

    public const string MediaLibraryName = "Images";

    [EditingComponent(MediaFilesSelector.IDENTIFIER, Label = "Background image", Order = 1)]
    [EditingComponentProperty(nameof(MediaFilesSelectorProperties.MaxFilesLimit), 1)]
    [EditingComponentProperty(nameof(MediaFilesSelectorProperties.LibraryName), MediaLibraryName)]
    [EditingComponentProperty(nameof(MediaFilesSelectorProperties.AllowedExtensions), ".gif;.png;.jpg;.jpeg;.svg;.webp")]
    public IEnumerable<MediaFilesSelectorItem> Image { get; set; } = new List<MediaFilesSelectorItem>();

But when I try and edit the widget properties in the Page Builder, nothing loads. I get a 404 error in the console for the following path, which is why I think it's not loading.

/cmsctx/pm/1f1c858f-8e22-48bc-aa75-8bcc97dba6ee/culture/en-GB/wg/4aecb2e8-8110-40fa-9997-b6a8a2f5ef8d/readonly/0/ea/1/h/0e20c0be9f14187f6e39b4dcfc0b708e3c8093c1b8375cd57959193443d203f8/-/Kentico.Components/Dialogs/KenticoMediaFilesDialog/GetFolderStructure?editmode=1&instance=b9462dd6-d0ab-4f38-a482-04b511a9488e&uh=95968dc8a7c6bdb871aceed20ec2acd5de51935f8de826188d14aa65dd28f730&administrationurl=https%3A%2F%2Flocalhost%2FABCSite_Admin&libraryName=Images

I have another widget that uses PathSelector, and this loads without issue.

Amy suggestions on what I might be missing?

Correct Answer

Juraj Ondrus answered on February 23, 2024 09:25

Turns out to be an issue with the external storage provider module class not being referenced in the front end app. After deploying the module class to the front end app solution media selector works fine.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Juraj Ondrus answered on February 21, 2024 07:45

I would try applying latest hotfix and also reproduce the issue using the sample Dancing Goat project - and then let us know the steps how to reproduce so we have the same code base.

0 votesVote for this answer Mark as a Correct answer

Danny Winbourne answered on February 21, 2024 10:04

Thanks for the reply, Juraj.

I've updated it to 13.0.139 (was on 13.0.134 before), and am getting the same issue.

The issue, however, does not occur on a Dancing Goat Core install on 130.0.31

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on February 21, 2024 10:07

So, I would inspect what is different in your environment setup (in case the Dancing Goat is not running the same) and also compare the implementation of the Dancing Goat project with yours. Any, even seemingly unrelated, difference can give us some hints

0 votesVote for this answer Mark as a Correct answer

Danny Winbourne answered on February 21, 2024 10:14

I publish from Visual Studio the .NET Core MVC site to a folder, which is used on an IIS site (so the site can run off a domain).

For Dancing Goat, only the admin site is in IIS.

Previously when running the MVC site directly from Visual Studio, no selector worked at all.

I am hoping the fact that I am getting a 404 on /cmsctx/pm.... on my project, but not Dancing Goat would help shed some further light on this.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on February 21, 2024 10:17

Well, 404 is way to general. I would need to know the steps how to reproduce the issue. I have no idea how your project looks like. What happens when you publish the Dancing Goat project in the same way? Are you publishing all the files? Is the target location cleared before publishing, no old files are left over? Have you tried re-publishing?

0 votesVote for this answer Mark as a Correct answer

Danny Winbourne answered on February 21, 2024 15:22

If I publish the Dancing Goat Project similarly, it still works as expected. I can't see anything different which might cause this issue. I've compared the startup.cs in both, and whilst not 100% identical, I can't see any differences that would cause this issue. I did notice that my published wwwroot file was missing the Content, PageBuilder, and Script folders which were present for Dancing goat, bugt after manually copying these, I still have the issue (they are missing as right now, we've excluded the entire wwwroot folder in our GIT).

I go back to an earlier comment in that other dialogs load and similar .cmsctx Urls load, which suggests that the appropriate routes are being set in most cases. I am just getting the 404 on GetFolderStructure. Loading the GetFolderStructure Url on dancing goat returns some Json.

I am using Azure Storage for my project, and not on Dancing goat. But surely this dialog should work with both?

Would this be better followed up via the normal support channels? It's for an existing Kentico client, who has a support contract.

I've yet to link this account to my new company, but shall I email support@kentico.com?

0 votesVote for this answer Mark as a Correct answer

Danny Winbourne answered on February 21, 2024 15:31

To Answer your specific questions: Yes, it deletes all files each time, and yes, I have republished several times. It publishes whatever files it needs to I suspect - That is in the control of Visual Studio.

0 votesVote for this answer Mark as a Correct answer

Danny Winbourne answered on February 21, 2024 17:15

Small update. I switched back to using local storage for the media library, and the dialog loads.

But, obviously this is not ideal. I’d expect the dialog to work with azure storage.

Please advise how I can do this, or confirm it’s a bug?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on February 22, 2024 06:05

So, what is the Azure storage provider code? I tried using it and it is working fine. I would recommend running it in the debug mode.

0 votesVote for this answer Mark as a Correct answer

Danny Winbourne answered on February 23, 2024 09:25

Turned out that the Initialisation Module was not included in the MVC solution. Once that was added, it started working fine.

0 votesVote for this answer Mark as a Correct answer

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