Skip to main content

Bugs - Q&A

Exporting PDF issue

By Cittadhammo 18 Aug 2024

I have a bug I cannot fix when trying to export PDF, like the Phase 6s Transition book

I have commented on github

image.png

Exporting PDF different render?

By Cittadhammo 18 Aug 2024

Can we try different things as well ?

https://www.bookstackapp.com/docs/admin/pdf-rendering/

Warning: This is option is not considered secure due to potential filesystem/network access.

This example uses weasyprint to generate PDF exports.

Q&A

Storage local vs google drive

storage limit https://www.bookstackapp.com/docs/admin/upload-config/

Email Sending Not Working [Fixed]

2 August 2024 Cittadhammo

We tried to log in with Rachaya with her 

unnamed.png

Credential, but then it said that she should confirm her email address first. When trying to send a verification email, we get the following error:


unnamed.png

Cannot upload image of maintenance book [Fixed]

30 Jul 2024 by Cittadhammo

When trying to upload a new image for the book, i get 

image.png

02 Aug 2024 by Adicco

The error came from the server not accepting file uploads above a certain size. This is fixed by updating the webserver's configuration to increase the size, or disable the limit altogether.

However, in our current stack, there are two servers involved, so we need to make sure their configuration is appropriate.

The first one is the nginx server running on the BookStack Docker container itself. It runs on port 3000, as per the docker compose file (/home/ec2-user/docker-bookstack/prod/compose.yml)

The configuration files for the Docker container's nginx server are found in /home/ec2-user/docker-bookstack/prod/bookstack_app_data/nginx. If we take a look at the main configuration file there, nginx.conf, we can see the following bit:

# Specifies the maximum accepted body size of a client request, as
# indicated by the request header Content-Length. If the stated content
# length is greater than this size, then the client receives the HTTP
# error code 413. Set to 0 to disable. Default is '1m'.
client_max_body_size 0;

So we know that the problem doesn't come from the Docker container, since it already allows files of unlimited size. Let's now turn to the second webserver that is running, another nginx instance installed on the EC2 instance itself, which runs above the Docker containers (prod and staging), so as to act as a reverse proxy. The config files are found at the standard location, /etc/nginx. If we take a look at the configuration file there, we see that there is no client_max_body_size directive, which means that it will use nginx's default, which is 1MB.

Let's make it unlimited by adding the following in the http section:

client_max_body_size 0; 

Then, check the configuration is valid:

sudo nginx -t

And restart nginx:

sudo systemctl restart nginx

02 Aug 2024 by Adicco (2)

It seems that there was another issue, one that I encountered when trying to update my avatar with a very large image. I would get a 500 error with no particular message. How to debug?

The log files are located at /home/ec2-user/docker-bookstack/prod/bookstack_app_data/log. For instance to see why the server returned a 500 error, you can, while in this directory, check the last 50 lines of the nginx error log:

tail -n 50 nginx/error.log 

Some lines will jump to attention straight away:

2024/08/02 09:05:50 [error] 301#301: *99 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 8192 bytes) in /app/www/vendor/intervention/image/src/Drivers/Gd/Cloner.php on line 59; PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 8192 bytes) in /app/www/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 317" while reading response header from upstream, client: 172.29.0.1, server: _, request: "POST /my-account/profile HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000", host: "wiki.amaravati.org", referrer: "https://wiki.amaravati.org/my-account/profile"

So here we have it: the PHP script exceeded the PHP engine's memory limit of 128MB, probably because image processing consumes more memory than the average task. To increase it, I added to /home/ec2-user/docker-bookstack/prod/bookstack_app_data/php/php-local.ini

memory_limit = 300M

Then don't forget to restart the container:

docker compose restart

Recovering password [fixed]

30 Jul 2024 by Cittadhammo

When logging into the wiki, if not remembering the password, the recovery email doesn't seem to work. (maybe only i account created via google auth)