Wiki: Uploaded media files are not accessible

Created on 16 Mar 2020  路  6Comments  路  Source: Requarks/wiki

Describe the bug
Last friday i started to use wikijs. Unfortunatelly I cannot upload files larger than 5MB. More precisely: files are uploaded, the success message shows up, they are present in the database table but not on the disk.

To Reproduce
Steps to reproduce the behavior:

  1. Change maxFileSize in config file to 20971520
  2. Upload file larger than 5MB
  3. Try to access file from browser or check the media folder on file server

Expected behavior
Uploaded file is accessible

Screenshots
Check this video for more details

Host Info (please complete the following information):

  • OS: Ubuntu 18.04
  • Wiki.js version: 2.1.113
  • Database engine: Maria DB 10.4.12
help

Most helpful comment

The database is the "source of truth". Pages and assets are only cached to disk to avoid pinging the database on every request. This allows for multiple instances to run simultaneously (e.g. in a Kubernetes cluster) without having to care about disk syncing between instances.

Today's databases are more than capable of storing large files efficiently.

All 6 comments

"You most likely have a reverse proxy in front (nginx / apache) with a default limit of 5 MB. You need to modify that limit as well."

No proxy, this is served straight from node: node server. Besides if it was a proxy problem, I would most likely see some errors. On the video you can clearly see that the request reached the wiki.

This isn't a proxy issue. Most likely a mariaDB blob size limit issue. Can you check in the assetsData table, with the associated ID if the row exists? Looks like the asset was created properly but not its content.

Try to increase the allowed size on your database as explained here:

There was no corresponding row in the assetsData table. max_allowed_packet was set to 16MB. I've changed it to 32MB. Now uploading is working properly. Just to satisfy my curiosity, why files are stored in database and on disk? Also I see data/cache folder ...

The database is the "source of truth". Pages and assets are only cached to disk to avoid pinging the database on every request. This allows for multiple instances to run simultaneously (e.g. in a Kubernetes cluster) without having to care about disk syncing between instances.

Today's databases are more than capable of storing large files efficiently.

Ok, thanks a lot @NGPixel

Was this page helpful?
0 / 5 - 0 ratings