Skip to content

Magento 2.4.5 Theme Assets to Amazon S3 Bucket

I setup a Magento 2.4.5-p1 to save media folder to S3 Bucket. Everythin worked as expected with product images. After this I install a theme that includes a Frontend-Builder. This theme reads and writes some assets from/to media folder. When I try to open the theme settings in configuration returns me the error:

Exception #0 (MagentoFrameworkExceptionLocalizedException): Unable to create directory 'https://xxxxxxx-magento-files-xxxxxxx.s3.eu-central-1.amazonaws.com'. Access forbidden.

When I inspect the media folder I see that is trying to create a folder and a new created folder named https: is there.
After this I checked the theme files and find the this:

public function getFileList()
    {
        $folderPath = $this->fileSystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath('/mgs/fbuilder/restore/');

        $io = $this->ioFile;
        $io->setAllowCreateFolders(true);
        $io->open(['path' => $this->fileSystem->getDirectoryRead(DirectoryList::MEDIA)->getAbsolutePath($folderPath)]);
        try {
            return array_reverse($io->ls());
        } catch (Exception $e) {
        }
        return null;
    }

I think that the problem is that trying to get media folder path which in this case is the S3 bucket url instead of var/www/... which is the absolute path that must use.
Μaybe i’m completely wrong but any help would be appreciated.