Media Library not opening

System Information
  • Strapi Version:
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:

Hi, I am new to strapi, I am facing issue with media library, as soon as I create a relationship between 2 content types, after that I cannot access my media library and cannot upload any media from the strapi admin.

From content manager I am unable to upload any media, it is always giving me this error:
“Woops! Something went wrong. Please, try again.”

And the media library is just showing a blank page, with this error in the console:
Uncaught TypeError: Failed to construct ‘URL’: Invalid URL

I am using the latest version of strapi and node version v18.2.0 and postgres as database.

Kindly assist for a possible solution, thanks

3 Likes

Yes I am having the same issue!

I got it working by first creating the content types and then populating the content types with atleast 2 entries each and then I created the relation between them and it worked, it is not showing any errors now and the media library is also working fine.

I got it fixed but I hope the Strapi Dev Team can take a note of this and fix this minor issue in the upcoming versions.

Hope it helps fellow devs and creators alike.

Regards

1 Like

I followed the quick start guide and then created a content type Blog with a media field, then I found out I can’t upload image and the media library broke down. Very annoying

After doing the changes as I have mentioned before, once I update the strapi version it again crashes when I try to access the media library, so I have created a backup and restored it to the previous version. @Eventyret kindly take note and please try to recreate on your end.

Regards

Yes Same Issue Here:
Strapi: 4.14.0-alpha.0
OS: Windows
Database: Mysql
Node: v18.16.1
npm: 9.5.1

I can’t upload and see Media Library Page on Strapi Admin (Crash) white blank, and have 2 entries of content type before, but same with no luck.
any solution?
Thanks

I am seeing the same issue with Media Library.

image

image

If someone here is having the same issue and is on version 4.14.0-alpha, then you can downgrade to version 4.13.6 to solve the issue.
I created a Strapi project recently and I don’t know why the alpha version is the default?

Hi! Can you explain in more detail what exactly you did because I’m trying the same thing and it doesn’t work for me?

I’m on v4.13.4 and also having this issue.

1 Like

Hi! using v4.14.0, also having the same issue, is it resolved now? or else what should do?

see

4.14.2 and same issue…

Just wanted to add some context to this ticket for the Strapi development team.

At least for our setup, this only seems to be an issue if you had existing items in your media library from 4.12.7 (our version) or earlier. A clean install with nothing in the media library works as expected.

Last tested was from 4.12.7 to 4.14.3 with the same issue still occurring. We’re seeing the same Invalid URL error that has been screenshot above.

Hi,

Unfortunately with version 4.14.4 it gets even worse.

I’m in production and so I can’t do a clean installation by emptying the database.
I can only do a clean installation of the software.

Among other things, the problem of sub-folders is also reflected in how to reach the address of admin: I have to use twice the url /strapi in the address bar of the browser (mydomain/strapi/strapi/admin).

I think that strapi has problems in managing url in the case of subfolders.

Check out my configuration files: I don’t think there are any errors or something missing

server.ts

export default ({ env }) => ({
  host: env('HOST', '0.0.0.0'),
  port: env.int('PORT', 1337),
  url: env('STRAPI_URL', '/strapi'),
  app: {
    keys: env.array('APP_KEYS'),
  },
  webhooks: {
    populateRelations: env.bool('WEBHOOKS_POPULATE_RELATIONS', false),
  },
});

admin.ts

export default ({ env }) => ({
  url: env('STRAPI_ADMIN_URL', '/strapi/admin'),
  auth: {
    secret: env('ADMIN_JWT_SECRET'),
  },
  apiToken: {
    salt: env('API_TOKEN_SALT'),
  },
  transfer: {
    token: {
      salt: env('TRANSFER_TOKEN_SALT'),
    },
  },
});

apache proxy config

<IfModule mod_ssl.c>
<VirtualHost *:443>
        ServerName mydomain
        ServerAlias mydomain
        DocumentRoot /var/www/mydomain/html/client

        <Directory /var/www/mydomain/html/client>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

        <IfModule mod_dir.c>
            DirectoryIndex index.php index.pl index.cgi index.html index.xhtml index.htm
        </IfModule>

	ProxyPreserveHost On
  	ProxyRequests Off
	ProxyPass /strapi http://localhost:1337
	ProxyPassReverse /strapi http://localhost:1337

</VirtualHost>
</IfModule>

For anyone with same issues, I got it fixed by adding URL to .env file and adding this line to config/server.js (under module.exports):
url: env("URL", "your_full_strapi_url"),

1 Like

Hi everyone,

I’m still encountering the same problem with Version 15.0.2. I’ve double-checked the URL entry in the .env and it’s correct. The problem is only occuring on my live site and staging. On local I am not facing this issue.

Has anyone faced a similar situation or has a workaround? Any guidance or suggestions would be greatly appreciated!

Thanks in advance for your help!

Please open a issue in if the issue already exists please react below it that you are having the same issue please also checked closed issues before opening a new one

Any updates on this issue?

1 Like

has anyone been able to resolve the upload issue? I have a similar issue but think might be related. I have 4.20.1 deployed. There is no error message. It just says “An error occurred while uploading the file” I dont even know where to look for logs.