LinkAce icon indicating copy to clipboard operation
LinkAce copied to clipboard

HTTP 500 Error on fresh Docker installation

Open bitcanon opened this issue 1 year ago • 4 comments

Bug Description

I followed the Setup with Docker (Advanced) setup instructions.

When trying step 4 (open the URL to LinkAce in the browser) I get an HTML 500 Error.

I found the error to be the APP_KEY in the .env file.

It is a bit unclear as to what I am supposed to do here:

# The app key is generated later, please leave it blank
APP_KEY=someRandomStringWith32Characters

Should I replace the string someRandomStringWith32Characters with 32 random characters or should I leave the APP_KEY blank? Neither work.

Solution To resolve the problem I ran the command sudo docker exec linkace-app-1 php artisan key:generate which generated a key into the .env file looking like this: APP_KEY=base64:80rXylOTk4Ve5aHFC2KzvaSXSSn4LtWl+y5Bax8bGdk=

When I opened the LinkAce URL in the browser I got the first time installation page as I initially expected and were able to complete the installation.

BTW: Thanks for your amazing work, I love the app so far 😁

How to reproduce

The initial value of the APP_KEY was:

# The app key is generated later, please leave it blank
APP_KEY=someRandomStringWith32Characters

I tried two things (in this order) to reproduce the error:

  1. Entered a random 32 character string, but I still got the 500 error: APP_KEY=Ays1tijwuWamodatpijDifpybwojTeud
  2. Left the APP_KEY blank, but I still got the 500 error: APP_KEY=

After both step 1 and 2 I opened the URL to the LinkAce app in the web browser and got an HTML 500 Internal Error page.

Expected behavior

I expected to see the first time setup page.

I also expected the APP_KEY to be automatically generated upon startup of the Docker containers.

Logs

No response

Screenshots

No response

LinkAce version

v1.10.4

Setup Method

Docker

Operating System

Linux (Ubuntu, CentOS,...)

Client details

bitcanon avatar Sep 08 '22 07:09 bitcanon

Could you take a look at the system logs (after install accessible via "system logs" under system settings)? Would be interesting to know what exactly the issue was. By default, Linkace should generate and set an application key on the first start (opened in browser). Maybe the .env file wasn't writable?

Kovah avatar Sep 08 '22 13:09 Kovah

I have been experimenting with this a while now and even though I have been coding Laravel a bit myself the whole Docker thing is completely new to me. I will try some more because I seem to get different results from time to time 😁

The .env file sure is writable and I have attached the log file for you. Looks like the linkace.settings table is missing when it shouldn't?

mikael@docker:~/linkace$ ls -la .env 
-rw-rw-rw- 1 mikael mikael 887 Sep  8 17:29 .env

laravel-2022-09-08.log

bitcanon avatar Sep 08 '22 15:09 bitcanon

If I leave the APP_KEY untouched it works, that is: APP_KEY=someRandomStringWith32Characters

If I change the APP_KEY to a string with 32 chars it works: APP_KEY=d961c3de6d6c99429806ae3d6d03f316

If I change the APP_KEY to a string with not having 32 chars it fails: APP_KEY=d961c3de6d6c99429806ae3d6d

If I leave the APP_KEY blank (no value) it fails, I get the 500 error: APP_KEY=

It might have been me that misinterpreted the line # The app key is generated later, please leave it blank that was the main issue here 🤔 When editing the .env file with more secure passwords I thought that I should remove the placeholder someRandomStringWith32Characters and change it to APP_KEY=.

bitcanon avatar Sep 08 '22 16:09 bitcanon

Thank you very much for the effort! The behavior you explained makes total sense, and the two first cases work as intended. A key shorter or longer than 32 chars (or empty) breaks the thing, because the underlying encryption algorithm expects exactly 32 characters.

I'll rephrase the notice above the app key to be more clear and maybe I can even check for the app key length before starting the whole application to prevent those 500 errors. 🤔

Kovah avatar Sep 08 '22 18:09 Kovah