Accessing Media/Folders and Media/Files with wix.query

These data does not seem to be accessible anymore !!!

I have a process that establish the link between photos loaded in a specific directory, in the media.
Let say we manage streets in the application. Each street has a unique identifier (streetid)
The name of the loaded photos (1 thousand+) is the streetid.jpg and there is only one photo per street.
The process I developped and run successfully one month ago is as follows.

  1. identify the wixref of the media folder in which I load the photos. (see code 1)
  2. in the photo directory, loop on every photos, get its name (the streetid) and its wix reference, and save this link in a collection (see code 2)
    The application list all the street (with paging/filters/…). when a street is selected, the detailed data are displayed with the photo of this street

Code 1

export async function buttonCheckDir_click(event) {
    console.log("Check Directories in folder media");
    TextInfoBloc("Add", "Start Check Directory photo", true);

    await wixData.query("Media/Folders")
        .then((results) => {
            // handle the results

            results.items.forEach((items, index) => {
                TextInfoBloc("Add", "index : " + index, true);
                TextInfoBloc("Add", "Name : " + items.folderName, true)
                TextInfoBloc("Add", "Folder ID : " + items.folderId, true)

                console.log("index " + index);
                console.log("Name " + items.folderName)
                console.log("Folder ID " + items.folderId)

Rem TextInfoBloc is a function that display on screen the results
results when I developped (december23, January24)
for exemple the directory “StreetPhoto” I used has an Id “7acba636ed5646dc9061dd367c803daf”
Results today : nothing (no error deected, I add a .catch in the query

Code 2

async function LoadPhotoLinks(Key) {
    TextInfoBloc("Add", "Start");

    let parentFolderId = "7acba636ed5646dc9061dd367c803daf";
    console.log("RetrieveAllPhotoStart folder " + parentFolderId);

    await wixData.query("Media/Files")
        .eq("parentFolderId", parentFolderId)
        .then((results) => {
            // handle the results

            for (var j = 0; j < results.items.length; j++) {

                // prepare for insert
                let LinkToInsert = {
                    "photoUrl": results.items[j].iconUrl,
                    "photoId": results.items[j].originalFileName
                wixData.insert("JPNPhotoLinks", LinkToInsert)
                    .then((item) => {
                    .catch((err) => {



    TextInfoBloc("Add", "Stop");


I simplified the code, mainly about a process to do this function 5 times 250 record each (so worked with limit and skip)
I was workin well when I developped 1/2 months ago, but today the the give no result, and no error catched ( i add a catch for testing)

Questions :

  • has the access to media/folders and media/files been changed (nothing in doc!), what can i do to have the infos?
  • is there a better and easyer way to link /find the iconUrl to the originalFileName that I can deduct from the streetid? May be dynamically!


I’m getting an access error on Media/Files and Folder even as an admin with suppressAuth. This might be a bug. I’ll escalate internally but please open a ticket as well so you can be updated on the progress: Contact Wix

BUg reported! Thank you

1 Like