leantime icon indicating copy to clipboard operation
leantime copied to clipboard

[BUG] Updating from 3.1.4 to the latest version makes Leantime unusable as login does not work anymore

Open RKLBusinessDevelopment opened this issue 1 year ago • 12 comments

If you have problems with the installation please use our community forum

What set up are you using

  • [ ] Cloud Hosted Version
  • [X] Self Hosted

Describe the bug After updating to the latest version, Leantime updates the database upon first login. After that, I can't login to Leantime any more. No error message, the credentials just won't work. I had to manually revert back to 3.1.4 and restore my database backup to use Leantime again.

To Reproduce Use a 3.1.4 self-hosted installation and update to the latest version.

Expected behavior Being able to login after Leantime has updated the database.

Leantime Version reverted back to 3.1.4, wanted to use the latest version

PHP / MySQL Version PHP 8.1.9 / MySQL 9.0.1

RKLBusinessDevelopment avatar Sep 04 '24 20:09 RKLBusinessDevelopment

I am also getting the same error. Message in leantime.log:

[2024-09-08 19:21:05] production.CRITICAL: PDOException: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'zp_calendar' already exists in /var/www/html/leantime/app/Domain/Install/Repositories/Install.php:239 Stack trace: #0 /var/www/html/leantime/app/Domain/Install/Repositories/Install.php(239): PDOStatement->execute() #1 /var/www/html/leantime/app/Domain/Install/Controllers/Index.php(95): Leantime\Domain\Install\Repositories\Install->setupDB() ... #41 /var/www/html/leantime/app/Core/Bootstrap/Bootloader.php(129): Leantime\Core\Bootstrap\Bootloader->handleRequest() #42 /var/www/html/leantime/public/index.php(13): Leantime\Core\Bootstrap\Bootloader->boot()

mattjbayly avatar Sep 08 '24 19:09 mattjbayly

i have the same problem, do you found a solution?

danmb315 avatar Sep 18 '24 20:09 danmb315

Do you have any other error messages from the logs?

marcelfolaron avatar Sep 20 '24 23:09 marcelfolaron

Also 3.2.1 is affected again. I am using the official docker image.

Screenshot 2024-09-23 100640

schories avatar Sep 23 '24 08:09 schories

Here is a fix which worked for me, means in case you have (e.g. the commercial) plugins installed:

  1. stop leantime (docker)
  2. move all the subdirs from /plugins to safe backup place; /plugins dir must be empty
  3. start leantime (docker), login should work fine again; however, additional steps 4-6 are still required
  4. redownload ALL apps from "app marketplace / explore apps" (re-)using your license key for each app
  5. disable ALL apps under "app marketplace / my apps"
  6. enable ALL apps under "app marketplace / my apps" again

A bit alarming (receiving a generic "error 500" message even on the login screen) and a bit tedious (fiddling with individual license keys and plugins/apps again) - but overall fixed in under 10 minutes.

I hope you find this information helpful and it saves you time.

schories avatar Sep 23 '24 08:09 schories

Thank you for the write up. The update from 3.1.4 to 3.2 requires all plugins to be disabled before the update. https://github.com/Leantime/leantime/releases/tag/v3.2.0

I'll see if we can check plugin versions early in the stack to not cause a 500 but some plugins tie in pretty early in the call stack.

marcelfolaron avatar Sep 23 '24 13:09 marcelfolaron

@marcelfolaron Thank you, Marcel. Personally I can live with that information & behavior, there are probably other more important topics.

schories avatar Sep 23 '24 13:09 schories

This doesn't fix the initial problem I have reported. I have not used any plugins at all and made sure there are none active when performing the upgrade to the latest Leantime version.

RKLBusinessDevelopment avatar Sep 23 '24 13:09 RKLBusinessDevelopment

@RKLBusinessDevelopment Sorry to hear that. Can you please enable debug and please let us know of the detailed error information in your case? I assume you run your very own classic installation not based the official docker image, correct?

As for @mattjbayly - sounds like the installer already ran but has not finished the first time. Depending on your server configuration (esp. php running as apache module or via fcgi) it could be something like max_execution_time being set to low, so that the scripts which invoke the MySQL statements are limited in some way. Can you please provide the output of phpinfo? I assume you run your very own classic installation not based the official docker image, correct?

Thank you!

schories avatar Sep 23 '24 14:09 schories

However, it is strange that setupDB is being run, as I would expect to run updateDB as all of you seem to update - not to freshly install.

So somewhat makes 3.2.x believe, that there is no (accessible) leantime database - and it starts an installation into an already existing database, which then fails as of course tables/views already exist.

schories avatar Sep 23 '24 14:09 schories

These 2 commits introduced with 3.2.0 could be relevant:

https://github.com/Leantime/leantime/commit/d58e1648f3d1fd8a115b6ba712b74000533385aa

https://github.com/Leantime/leantime/commit/85a96484e0017f24f9d82e79f59a29e4b00b9d36

@RKLBusinessDevelopment @mattjbayly Possibly there is an issue with the database/schema versioning - or detecting the version correctly. Thus it would be helpful if you please provide the version information as it is currently stored in your leantime MySQL database. Then we can hopefully see what might be the actual issue / root cause.

schories avatar Sep 23 '24 14:09 schories

Exactly same story here, but run on docker on Synolog DSM. I tried a full fresh installation of 3.20 or 3.2.1, but still behave as described above.

PGostek avatar Sep 26 '24 11:09 PGostek

Hi, same here. I just updated your official docker image on synology to 3.2.1 After that the login is no longer possible. After login the page just refresh and shows the login screen again.

kh3b avatar Oct 23 '24 08:10 kh3b

From what I can gather across other issue reports, the main problem is a new config that set cookies to be secure only. Meaning they have to be served via https. You can either try use a self signed certificate via reverse proxy or you can set the config in app/core until we have a fix out to make this a config var. Solution is outlined here: https://github.com/Leantime/leantime/issues/2699

marcelfolaron avatar Oct 23 '24 11:10 marcelfolaron

Thanks! Setting the secure flag to false helped!

kh3b avatar Oct 25 '24 07:10 kh3b

3.3 now has a config for LEANTIME_SESSION_SECURE which solves this issue

marcelfolaron avatar Nov 16 '24 19:11 marcelfolaron