
Hi i'm using the migrations feature to move my project to a new server. When I try to import the project I get this error in the appwrite container:
[Error] Timestamp: 2023-11-23T07:42:16+00:00
[Error] Method: GET
[Error] URL: /v1/migrations
[Error] Type: Appwrite\Extend\Exception
[Error] Message: Project with the requested ID could not be found. Please check the value of the X-Appwrite-Project header to ensure the correct project ID is being used.
[Error] File: /usr/src/code/app/controllers/general.php
[Error] Line: 324
Warning: Undefined array key -1 in /usr/src/code/vendor/utopia-php/migration/src/Migration/Sources/Appwrite.php on line 226
Warning: Trying to access array offset on value of type null in /usr/src/code/vendor/utopia-php/migration/src/Migration/Sources/Appwrite.php on line 226
[Error] Timestamp: 2023-11-23T07:43:05+00:00
[Error] Method: GET
[Error] URL: /v1/migrations/firebase/projects
[Error] Type: Appwrite\Extend\Exception
[Error] Message: The identity could not be found. Please sign in with OAuth provider to create identity first.
[Error] File: /usr/src/code/app/controllers/api/migrations.php
[Error] Line: 805
and this error in the appwrite-worker-migrations container:
Appwrite\Platform\Workers\Migrations::processSource(): Argument #2 ($credentials) must be of type array, bool given, called in /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php on line 255
Both servers are on version 1.4.13. It is also not related to what I import, I always get this error.

What were the exact steps you took?

I logged in to Appwrite on the new server I created a new organisation I clicked on: Create project -> Import project Then i'm on the view to select the source. Appwrite Self-hosted is selected by default, I inserted the endpoint, project id and api key of the old server. After that I selected import users and then I started the import.

Hmm ...now if you try again by going into the empty project on your new server and trying to import again, what happens?

More errors in the appwrite-worker-migrations container:
Worker migrations started
[Job] Received Job (655f02890aebb7.05921434).
Appwrite\Platform\Workers\Migrations::processSource(): Argument #2 ($credentials) must be of type array, bool given, called in /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php on line 255
Appwrite\Platform\Workers\Migrations::processSource(): Argument #2 ($credentials) must be of type array, bool given, called in /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php on line 255
#0 /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php(255): Appwrite\Platform\Workers\Migrations->processSource('Appwrite', false)
#1 /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php(85): Appwrite\Platform\Workers\Migrations->processMigration(Object(Utopia\Database\Document), Object(Utopia\Database\Document))
#2 /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php(49): Appwrite\Platform\Workers\Migrations->action(Object(Utopia\Queue\Message), Object(Utopia\Database\Database), Object(Utopia\Database\Database))
#3 /usr/src/code/vendor/utopia-php/queue/src/Queue/Server.php(248): Appwrite\Platform\Workers\Migrations->Appwrite\Platform\Workers\{closure}(Object(Utopia\Queue\Message), Object(Utopia\Database\Database), Object(Utopia\Database\Database))
#4 [internal function]: Utopia\Queue\Server->Utopia\Queue\{closure}('0')
#5 /usr/src/code/vendor/utopia-php/queue/src/Queue/Adapter/Swoole.php(37): call_user_func(Object(Closure), '0')
#6 {main}
[Job] (655f02890aebb7.05921434) successfully run.

[Job] Received Job (656597fdeb84b4.71463952).
[Job] (656597fdeb84b4.71463952) failed to run.
[Job] (656597fdeb84b4.71463952) MySQL server has gone away
Fatal error: Uncaught PDOException: MySQL server has gone away in @swoole-src/library/core/Database/PDOStatementProxy.php:62
Stack trace:
#0 /usr/src/code/vendor/utopia-php/database/src/Database/Adapter/MariaDB.php(731): Swoole\Database\PDOStatementProxy->__call('execute', Array)
#1 /usr/src/code/vendor/utopia-php/database/src/Database/Database.php(2712): Utopia\Database\Adapter\MariaDB->createDocument('keys', Object(Utopia\Database\Document))
#2 /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php(222): Utopia\Database\Database->createDocument(Object(Utopia\Database\Document), Object(Utopia\Database\Document))
#3 /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php(247): Appwrite\Platform\Workers\Migrations->generateAPIKey(Object(Utopia\Database\Document))
#4 /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php(85): Appwrite\Platform\Workers\Migrations->processMigration(Object(Utopia\Database\Document), Object(Utopia\Database\Document))
#5 /usr/src/code/src/Appwrite/Platform/Workers/Migrations.php(49): Appwrite\Platform\Workers\Migrations->action(Object(Utopia\Queue\Message), Object(Utopia\Database\Database), Object(Utopia\Database\Database))
#6 /usr/src/code/vendor/utopia-php/queue/src/Queue/Server.php(248): Appwrite\Platform\Workers\Migrations->Appwrite\Platform\Workers\{closure}(Object(Utopia\Queue\Message), Object(Utopia\Database\Database), Object(Utopia\Database\Database))
#7 [internal function]: Utopia\Queue\Server->Utopia\Queue\{closure}('0')
#8 /usr/src/code/vendor/utopia-php/queue/src/Queue/Adapter/Swoole.php(37): call_user_func(Object(Closure), '0')
#9 {main}
thrown in @swoole-src/library/core/Database/PDOStatementProxy.php on line 62
[Worker] Worker 0 is ready!

Also the weird thing is when I refresh i'm logged out but I have no idea why. I feel like it must be related to that 🤔

I ran the update script and that fixed the issue: https://appwrite.io/docs/advanced/self-hosting/update So I will mark this as solved 🤷♂️

[SOLVED] Error when importing project (Migrations)
Recommended threads
- NIOHTTPCompression-Error
Hi, I have self-hosted Appwrite via Coolify on a Ubuntu-VPS . I am accessing the Database via Swift. Everything is working as expected, but with one collection ...
- Updating OTP Session template not workin...
I have self hosted with v1.7.4, while updating OTP Session template, verification template is being updated, earlier there was an issue with variables but not i...
- Errors in collection filtering
1 - The list does not appear after pressing the Apply Filter button. After the filter is applied, I cannot see which filter I applied. 2 - When adding the 2nd f...
