Media Library URL Error

System Information
  • Strapi Version: 4.13.3
  • Operating System: Windows/Ubuntu
  • Database: SQLite
  • Node Version: 18.6.1
  • NPM Version: 9.7.2
  • Yarn Version: -

When trying to enter “Media Library” i get an error in console

Uncaught TypeError: Failed to construct 'URL': Invalid URL



I tried to rollback to older versions of strapi, but it did not help, I also tried to remove different plugins and that did not help either.

1 Like

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
any solution?

1 Like

I have the same error. Please help!!. Thanks
strapi: 4.13.6
OS: linux Red Hat 8
Database: Postgres
node: 18.17.1
npm: 9.6.7

I faced the same problem. To fix I found two solutions :

  • set STRAPI_ADMIN_BACKEND_URL to the URL of your strapi instance. It seems that it should be done at build time
  • use the following patch package
diff --git a/node_modules/@strapi/plugin-upload/admin/src/utils/appendSearchParamsToUrl.js b/node_modules/@strapi/plugin-upload/admin/src/utils/appendSearchParamsToUrl.js
index 730ba50..142f333 100644
--- a/node_modules/@strapi/plugin-upload/admin/src/utils/appendSearchParamsToUrl.js
+++ b/node_modules/@strapi/plugin-upload/admin/src/utils/appendSearchParamsToUrl.js
@@ -10,7 +10,7 @@ const appendSearchParamsToUrl = ({ url, params }) => {
     return url;
-  const urlObj = new URL(url, window.strapi.backendURL ?? window.location.origin);
+  const urlObj = new URL(url, window.strapi.backendURL || window.location.origin);
   Object.entries(params).forEach(([key, value]) => {
     if (value !== undefined) {

Are you saying either solution will work, or are both required?


Either solution will work.

STRAPI_ADMIN_BACKEND_URL Is an environnement variable that should be set at build time

That worked, thank you!