Back

Migration from 1.4.14 to 1.5.4 (or 7) fails with Swoole error

  • 0
  • Self Hosted
  • Flutter
Madalee
7 Jun, 2024, 21:43

and I've done that, and they all start, and look happy from their logs, but when I run migrate, I get the swoole error

TL;DR
Developers are encountering an error when migrating from version 1.4.14 to 1.5.7, specifically a Swoole error related to database connection. The error seems to be caused by issues with database connectivity rather than the reported PDO coroutine problem. Suggestions include verifying environment variables, user access to the database, and ensuring the correct database username is used. Running a doctor command and inspecting the container may also help diagnose the connection issue. Upgrading to version 1.5.7 is recommended, and setting up a separate test stack for testing upgrades instead of performing them directly on the production instance. Ensure that
Madalee
7 Jun, 2024, 21:43

This is the full error

TypeScript
Fatal error: Uncaught Swoole\Error: API must be called in the coroutine in /usr/src/code/app/init.php:928
Stack trace:
#0 /usr/src/code/app/init.php(928): PDO->__construct('mysql:host=mari...', 'apps', Object(SensitiveParameterValue), Array)
#1 /usr/src/code/vendor/utopia-php/registry/src/Registry/Registry.php(75): {closure}()
#2 /usr/src/code/src/Appwrite/Platform/Tasks/Migrate.php(98): Utopia\Registry\Registry->get('db', true)
#3 /usr/src/code/src/Appwrite/Platform/Tasks/Migrate.php(34): Appwrite\Platform\Tasks\Migrate->action('1.5.4', Object(Utopia\Cache\Cache), Object(Utopia\Database\Database), Object(Closure), Object(Utopia\Registry\Registry))
#4 /usr/src/code/vendor/utopia-php/cli/src/CLI/CLI.php(320): Appwrite\Platform\Tasks\Migrate->Appwrite\Platform\Tasks\{closure}('1.5.4', Object(Utopia\Cache\Cache), Object(Utopia\Database\Database), Object(Closure), Object(Utopia\Registry\Registry))
#5 /usr/src/code/app/cli.php(191): Utopia\CLI\CLI->run()
#6 {main}
  thrown in /usr/src/code/app/init.php on line 928
Madalee
7 Jun, 2024, 21:43

In case anything in that stack trace is of any use

Steven
7 Jun, 2024, 21:44

you should have called this from one of the existing test appwrite containers. is that what you did?

Steven
7 Jun, 2024, 21:44

also you should update to 1.5.7

Madalee
7 Jun, 2024, 21:45

oh, right, let me flip this back to 1.5.7, I was hitting 1.5.4 because 1.5.7 didnt work. I thought maybe I needed to step version by version

Madalee
7 Jun, 2024, 21:46

I called migrate AFTER starting the test container using 1.5.7 Should the running container be 1.4.14 but I run migrate with the 1.5.7 app/src ?

Steven
7 Jun, 2024, 21:46

running container should be 1.5.7

Madalee
7 Jun, 2024, 21:47

That was the case, but let me go back to 1.5.7 and validate

Steven
7 Jun, 2024, 21:47

something seems wrong with your db connection

Steven
7 Jun, 2024, 21:48

inspec the container and make sure the _APP_DB_* env vars are correct and the user has full access to the db

Madalee
7 Jun, 2024, 21:49

Do you know if there is some command/file in the appwrite container that I could use to validate the sql connection from within the container? I assume mysql client is not there. But thought there might be an appwrite based php or node command I could run to validate DB connection

Steven
7 Jun, 2024, 21:51
Steven
7 Jun, 2024, 21:51

but that might give the same error

Madalee
7 Jun, 2024, 21:52

I'll give it a shot

Madalee
7 Jun, 2024, 21:54

Does the main appwrite container use: _APP_OPENSSL_KEY_V1 now?

Steven
7 Jun, 2024, 21:54

it always did 👀

Madalee
7 Jun, 2024, 21:55

once this is up, I'll try that as well. I didn't have that set on 1.4.x for the main appwrite container...

Madalee
7 Jun, 2024, 21:57

I bet it was pulling the default secret key and working for that reason

Madalee
7 Jun, 2024, 21:57
Madalee
7 Jun, 2024, 21:57

Doctor seems to be able to connect to the db

Madalee
7 Jun, 2024, 21:57

both console and Projects

Steven
7 Jun, 2024, 21:59

👀 there isn't a default

Steven
7 Jun, 2024, 21:59

this is the same container you ran the migrate command?

Madalee
7 Jun, 2024, 21:59

yes

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more