Skip to content

Media Library crashes with an error message while loading one or more images #18175

@pgsfredda

Description

@pgsfredda

Bug report

Required System information

  • Strapi Version: 4.13.7
  • Operating System: Ubuntu 20.04.6 LTS
  • Database: mySQL 8.0.34 (using mysql2 as driver)
  • Node Version: 18.18.0
  • NPM Version: 9.8.1
  • Yarn Version: none
  • Dev language: typescript

Describe the bug

When I try to load one or more images (size: 5kb) Strapi Admin get an error message:
Woops! Something went wrong. Please, try again.

Steps to reproduce the behavior

  1. Go to Media Library
  2. Click on Add new assets
  3. Browsing files or dragging the image (max image size used is 5kb)
  4. See error Woops! Something went wrong. Please, try again.
  5. The error reported in the console is:

immagine

No error messages on server log.

Additional context

The production strapi configuration is under the sub path /strapi

My config/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),
  },
});

My config/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'),
    },
  },
});

No api prefix configured in config/admin.ts.

Any other configuration do not work with my apache proxy configuration (HTTP 404 Not found error message emitted by strapi).

Admin build command:
NODE_ENV=production STRAPI_URL=/strapi STRAPI_ADMIN_URL=/strapi/admin npm run build

My apache proxy config:

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

        <Directory /var/www/mydomain/html>
            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>

When I make the same test on local machine, without server url field definition, strapi admin works fine.

Can someone help me? Thank you in advance

Metadata

Metadata

Assignees

Labels

issue: bugIssue reporting a bugseverity: mediumIf it breaks the basic use of the product but can be worked aroundsource: core:uploadSource is core/upload packagestatus: confirmedConfirmed by a Strapi Team member or multiple community members

Type

No type

Projects

Status

Fixed/Shipped

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions