From e8d40a48dc72535f321c61088bb250d48b6ac1f6 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 29 Jan 2026 17:13:01 +0200 Subject: [PATCH 01/24] endpoint --- .env | 1 + composer.lock | 4 +- docker-compose.yml | 2 + src/Appwrite/Platform/Workers/Migrations.php | 49 ++++++++++---------- 4 files changed, 29 insertions(+), 27 deletions(-) diff --git a/.env b/.env index 1947ddff1a..27b3afb442 100644 --- a/.env +++ b/.env @@ -130,3 +130,4 @@ _APP_PROJECT_REGIONS=default _APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000 _APP_STATS_USAGE_DUAL_WRITING_DBS=database_db_main _APP_TRUSTED_HEADERS=x-forwarded-for +_APP_MIGRATION_ENDPOINT=http://appwrite.test/v1 \ No newline at end of file diff --git a/composer.lock b/composer.lock index 1c7e6c2a5b..a63ff958aa 100644 --- a/composer.lock +++ b/composer.lock @@ -9051,7 +9051,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -9075,5 +9075,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" } diff --git a/docker-compose.yml b/docker-compose.yml index b32c41f802..fcfecdd527 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -227,6 +227,7 @@ services: - _APP_FUNCTIONS_CREATION_ABUSE_LIMIT - _APP_CUSTOM_DOMAIN_DENY_LIST - _APP_TRUSTED_HEADERS + - _APP_MIGRATION_ENDPOINT extra_hosts: - "host.docker.internal:host-gateway" @@ -805,6 +806,7 @@ services: - _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET - _APP_DATABASE_SHARED_TABLES - _APP_OPTIONS_FORCE_HTTPS + - _APP_MIGRATION_ENDPOINT appwrite-task-maintenance: entrypoint: maintenance diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 6ef2f1899c..d78f207998 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -26,7 +26,6 @@ use Utopia\Migration\Destinations\Appwrite as DestinationAppwrite; use Utopia\Migration\Destinations\CSV as DestinationCSV; use Utopia\Migration\Exception as MigrationException; use Utopia\Migration\Source; -use Utopia\Migration\Sources\Appwrite; use Utopia\Migration\Sources\Appwrite as SourceAppwrite; use Utopia\Migration\Sources\CSV; use Utopia\Migration\Sources\Firebase; @@ -160,19 +159,19 @@ class Migrations extends Action /** * @throws Exception */ - protected function processSource(Document $migration, array $platform): Source + protected function processSource(Document $migration): Source { $source = $migration->getAttribute('source'); $destination = $migration->getAttribute('destination'); $resourceId = $migration->getAttribute('resourceId'); $credentials = $migration->getAttribute('credentials'); $migrationOptions = $migration->getAttribute('options'); - $dataSource = Appwrite::SOURCE_API; + $dataSource = SourceAppwrite::SOURCE_API; $database = null; $queries = []; - if ($source === Appwrite::getName() && $destination === DestinationCSV::getName()) { - $dataSource = Appwrite::SOURCE_DATABASE; + if ($source === SourceAppwrite::getName() && $destination === DestinationCSV::getName()) { + $dataSource = SourceAppwrite::SOURCE_DATABASE; $database = $this->dbForProject; $queries = Query::parseQueries($migrationOptions['queries']); } @@ -225,17 +224,15 @@ class Migrations extends Action /** * @throws Exception */ - protected function processDestination(Document $migration, string $apiKey, array $platform): Destination + protected function processDestination(Document $migration, string $apiKey, string $endpoint): Destination { $destination = $migration->getAttribute('destination'); $options = $migration->getAttribute('options', []); - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; - return match ($destination) { DestinationAppwrite::getName() => new DestinationAppwrite( $this->project->getId(), - $protocol . '://' . $platform['apiHostname'] . '/v1', + $endpoint, $apiKey, $this->dbForProject, Config::getParam('collections', [])['databases']['collections'], @@ -335,22 +332,24 @@ class Migrations extends Action $transfer = $source = $destination = null; - try { - if ( - $migration->getAttribute('source') === SourceAppwrite::getName() && - empty($migration->getAttribute('credentials', [])) - ) { - $credentials = $migration->getAttribute('credentials', []); - $credentials['projectId'] = $credentials['projectId'] ?? $project->getId(); - $credentials['apiKey'] = $credentials['apiKey'] ?? $tempAPIKey; + //$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; + // $endpoint = $protocol . '://' . $platform['apiHostname'] . '/v1'; + $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); - /** - * endpoint set - */ - if (empty($credentials['endpoint'])) { - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; - $credentials['endpoint'] = $protocol . '://' . $platform['apiHostname'] . '/v1'; + try { + if ($migration->getAttribute('source') === SourceAppwrite::getName()) { + $credentials = $migration->getAttribute('credentials', []); + + if (empty($credentials)) { + $credentials['projectId'] = $project->getId(); + $credentials['apiKey'] = $tempAPIKey; + $credentials['endpoint'] = $endpoint; } + + if (($credentials['endpoint'] ?? '') === 'http://localhost/v1') { + $credentials['endpoint'] = $endpoint; + } + $migration->setAttribute('credentials', $credentials); } @@ -358,8 +357,8 @@ class Migrations extends Action $migration->setAttribute('status', 'processing'); $this->updateMigrationDocument($migration, $project, $queueForRealtime); - $source = $this->processSource($migration, $platform); - $destination = $this->processDestination($migration, $tempAPIKey, $platform); + $source = $this->processSource($migration); + $destination = $this->processDestination($migration, $tempAPIKey, $endpoint); $transfer = new Transfer( $source, From ddb72c754688fb9b55ad5908ab3e62f951a728bb Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 29 Jan 2026 17:32:28 +0200 Subject: [PATCH 02/24] set credentials --- src/Appwrite/Platform/Workers/Migrations.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index d78f207998..66f39a4336 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -337,22 +337,22 @@ class Migrations extends Action $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); try { - if ($migration->getAttribute('source') === SourceAppwrite::getName()) { - $credentials = $migration->getAttribute('credentials', []); + $credentials = $migration->getAttribute('credentials', []); + if ($migration->getAttribute('source') === SourceAppwrite::getName()) { if (empty($credentials)) { $credentials['projectId'] = $project->getId(); $credentials['apiKey'] = $tempAPIKey; $credentials['endpoint'] = $endpoint; } - - if (($credentials['endpoint'] ?? '') === 'http://localhost/v1') { - $credentials['endpoint'] = $endpoint; - } - - $migration->setAttribute('credentials', $credentials); } + if (($credentials['endpoint'] ?? '') === 'http://localhost/v1') { + $credentials['endpoint'] = $endpoint; + } + + $migration->setAttribute('credentials', $credentials); + $migration->setAttribute('stage', 'processing'); $migration->setAttribute('status', 'processing'); $this->updateMigrationDocument($migration, $project, $queueForRealtime); From 6e6081f693352a8634e157b293bb2f873a14c0cc Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 29 Jan 2026 17:33:37 +0200 Subject: [PATCH 03/24] set credentials --- src/Appwrite/Platform/Workers/Migrations.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 66f39a4336..cef732b08c 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -332,8 +332,13 @@ class Migrations extends Action $transfer = $source = $destination = null; - //$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; - // $endpoint = $protocol . '://' . $platform['apiHostname'] . '/v1'; + + /** + * Old logic + * $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; + * $endpoint = $protocol . '://' . $platform['apiHostname'] . '/v1'; + */ + $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); try { From 5c61f7232a4357011310749284e092a26d6f4d34 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 29 Jan 2026 18:22:56 +0200 Subject: [PATCH 04/24] _APP_MIGRATION_ENDPOINT --- docker-compose.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index eb3cc77bb4..4fed970f5e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -228,7 +228,6 @@ services: - _APP_FUNCTIONS_CREATION_ABUSE_LIMIT - _APP_CUSTOM_DOMAIN_DENY_LIST - _APP_TRUSTED_HEADERS - - _APP_MIGRATION_ENDPOINT extra_hosts: - "host.docker.internal:host-gateway" From 9d7bc04089923dd6d9541c627d540dee9a73473f Mon Sep 17 00:00:00 2001 From: fogelito Date: Fri, 30 Jan 2026 10:04:09 +0200 Subject: [PATCH 05/24] throw --- src/Appwrite/Platform/Workers/Migrations.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index cef732b08c..3dd4c3f771 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -340,6 +340,9 @@ class Migrations extends Action */ $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); + if(empty($endpoint)){ + throw new \Exception('empty _APP_MIGRATION_ENDPOINT'); + } try { $credentials = $migration->getAttribute('credentials', []); From a38b6cc78d2e3ed9e02e7989d9fc0075a4a74606 Mon Sep 17 00:00:00 2001 From: fogelito Date: Fri, 30 Jan 2026 10:05:11 +0200 Subject: [PATCH 06/24] lock --- composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/composer.lock b/composer.lock index 078c9c56b7..6f8338a676 100644 --- a/composer.lock +++ b/composer.lock @@ -756,16 +756,16 @@ }, { "name": "google/protobuf", - "version": "v4.33.4", + "version": "v4.33.5", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "22d28025cda0d223a2e48c2e16c5284ecc9f5402" + "reference": "ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/22d28025cda0d223a2e48c2e16c5284ecc9f5402", - "reference": "22d28025cda0d223a2e48c2e16c5284ecc9f5402", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d", + "reference": "ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d", "shasum": "" }, "require": { @@ -794,9 +794,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.4" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.5" }, - "time": "2026-01-12T17:58:43+00:00" + "time": "2026-01-29T20:49:00+00:00" }, { "name": "halaxa/json-machine", From 23f08ef1442a5c42a77b8de6ebfb0cae0023d4c2 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 08:46:39 +0200 Subject: [PATCH 07/24] formatting --- src/Appwrite/Platform/Workers/Migrations.php | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 3dd4c3f771..9ba9458c39 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -332,16 +332,9 @@ class Migrations extends Action $transfer = $source = $destination = null; - - /** - * Old logic - * $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; - * $endpoint = $protocol . '://' . $platform['apiHostname'] . '/v1'; - */ - $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); - if(empty($endpoint)){ - throw new \Exception('empty _APP_MIGRATION_ENDPOINT'); + if (empty($endpoint)) { + throw new \Exception('_APP_MIGRATION_ENDPOINT env is empty'); } try { @@ -355,6 +348,10 @@ class Migrations extends Action } } + if ($migration->getAttribute('destination') === DestinationAppwrite::getName()) { + + } + if (($credentials['endpoint'] ?? '') === 'http://localhost/v1') { $credentials['endpoint'] = $endpoint; } @@ -581,7 +578,8 @@ class Migrations extends Action ]); // Generate download URL with JWT - $endpoint = System::getEnv('_APP_DOMAIN', ''); + + $endpoint = System::getEnv('_APP_DOMAIN', ''); // Can use System::getEnv('_APP_MIGRATION_ENDPOINT'); ? $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled' ? 'https' : 'http'; $downloadUrl = "{$protocol}://{$endpoint}/v1/storage/buckets/{$bucketId}/files/{$fileId}/push?project={$project->getId()}&jwt={$jwt}"; $options['downloadUrl'] = $downloadUrl; From 7da2bdf4da881d66e859f7d7e470bb025e752f80 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 10:36:38 +0200 Subject: [PATCH 08/24] remove extra vars --- src/Appwrite/Platform/Workers/Migrations.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 9ba9458c39..583eeeec9c 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -224,16 +224,17 @@ class Migrations extends Action /** * @throws Exception */ - protected function processDestination(Document $migration, string $apiKey, string $endpoint): Destination + protected function processDestination(Document $migration): Destination { $destination = $migration->getAttribute('destination'); $options = $migration->getAttribute('options', []); + $credentials = $migration->getAttribute('credentials'); return match ($destination) { DestinationAppwrite::getName() => new DestinationAppwrite( $this->project->getId(), - $endpoint, - $apiKey, + $credentials['destinationEndpoint'], + $credentials['destinationApiKey'], $this->dbForProject, Config::getParam('collections', [])['databases']['collections'], ), @@ -349,7 +350,8 @@ class Migrations extends Action } if ($migration->getAttribute('destination') === DestinationAppwrite::getName()) { - + $credentials['destinationApiKey'] = $tempAPIKey; + $credentials['destinationEndpoint'] = $endpoint; } if (($credentials['endpoint'] ?? '') === 'http://localhost/v1') { From e1f8d0bbbcc965dce43b36805df2652b0f7ad072 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 10:38:04 +0200 Subject: [PATCH 09/24] remove extra vars --- src/Appwrite/Platform/Workers/Migrations.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 583eeeec9c..1ef1d68a9b 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -365,7 +365,7 @@ class Migrations extends Action $this->updateMigrationDocument($migration, $project, $queueForRealtime); $source = $this->processSource($migration); - $destination = $this->processDestination($migration, $tempAPIKey, $endpoint); + $destination = $this->processDestination($migration); $transfer = new Transfer( $source, From 771dd92a141cce45016891fd502d4ae708aa4f64 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 11:55:01 +0200 Subject: [PATCH 10/24] https --- .env | 2 +- phpunit.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 5f7a76d4ea..210085372c 100644 --- a/.env +++ b/.env @@ -131,4 +131,4 @@ _APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000 _APP_STATS_USAGE_DUAL_WRITING_DBS=database_db_main _APP_TRUSTED_HEADERS=x-forwarded-for _APP_POOL_ADAPTER=stack -_APP_MIGRATION_ENDPOINT=http://appwrite.test/v1 \ No newline at end of file +_APP_MIGRATION_ENDPOINT=https://appwrite.test/v1 \ No newline at end of file diff --git a/phpunit.xml b/phpunit.xml index a8578995c1..215ee2d59d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" + stopOnFailure="true" > From 6011a7c66d1844a7d47af9d7e73498768d75ebb9 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 12:00:04 +0200 Subject: [PATCH 11/24] http --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 210085372c..5f7a76d4ea 100644 --- a/.env +++ b/.env @@ -131,4 +131,4 @@ _APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000 _APP_STATS_USAGE_DUAL_WRITING_DBS=database_db_main _APP_TRUSTED_HEADERS=x-forwarded-for _APP_POOL_ADAPTER=stack -_APP_MIGRATION_ENDPOINT=https://appwrite.test/v1 \ No newline at end of file +_APP_MIGRATION_ENDPOINT=http://appwrite.test/v1 \ No newline at end of file From 88044eaa71d407e39d27cb39379779328e4a0e6b Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 12:15:32 +0200 Subject: [PATCH 12/24] check key --- src/Appwrite/Platform/Workers/Migrations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 1ef1d68a9b..48d125f6c6 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -343,8 +343,8 @@ class Migrations extends Action if ($migration->getAttribute('source') === SourceAppwrite::getName()) { if (empty($credentials)) { - $credentials['projectId'] = $project->getId(); - $credentials['apiKey'] = $tempAPIKey; + $credentials['projectId'] = $credentials['projectId'] ?? $project->getId(); + $credentials['apiKey'] = $credentials['apiKey'] ?? $tempAPIKey; $credentials['endpoint'] = $endpoint; } } From d19eec9849ea3e32fd9e677aa3121d40197a2995 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 12:31:17 +0200 Subject: [PATCH 13/24] var dump --- src/Appwrite/Platform/Workers/Migrations.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 48d125f6c6..b27c8e4f56 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -360,6 +360,8 @@ class Migrations extends Action $migration->setAttribute('credentials', $credentials); + var_dump($credentials); + $migration->setAttribute('stage', 'processing'); $migration->setAttribute('status', 'processing'); $this->updateMigrationDocument($migration, $project, $queueForRealtime); From 40dede6503d5686fe479d045688caafe5d8cc697 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 14:54:42 +0200 Subject: [PATCH 14/24] Use apiHostname --- src/Appwrite/Platform/Workers/Migrations.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index b27c8e4f56..acec464974 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -338,6 +338,9 @@ class Migrations extends Action throw new \Exception('_APP_MIGRATION_ENDPOINT env is empty'); } + $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; + $endpoint = $protocol . '://' . $platform['apiHostname'] . '/v1'; + try { $credentials = $migration->getAttribute('credentials', []); @@ -360,8 +363,6 @@ class Migrations extends Action $migration->setAttribute('credentials', $credentials); - var_dump($credentials); - $migration->setAttribute('stage', 'processing'); $migration->setAttribute('status', 'processing'); $this->updateMigrationDocument($migration, $project, $queueForRealtime); From 644dcb8fb15341c5c0e339efd3f1f602fe14e0e1 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 15:11:29 +0200 Subject: [PATCH 15/24] empty $credentials --- src/Appwrite/Platform/Workers/Migrations.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index acec464974..f1b501d2be 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -338,6 +338,9 @@ class Migrations extends Action throw new \Exception('_APP_MIGRATION_ENDPOINT env is empty'); } + /** + * Overwrite env + */ $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $endpoint = $protocol . '://' . $platform['apiHostname'] . '/v1'; @@ -346,8 +349,10 @@ class Migrations extends Action if ($migration->getAttribute('source') === SourceAppwrite::getName()) { if (empty($credentials)) { - $credentials['projectId'] = $credentials['projectId'] ?? $project->getId(); - $credentials['apiKey'] = $credentials['apiKey'] ?? $tempAPIKey; + //$credentials['projectId'] = $credentials['projectId'] ?? $project->getId(); + //$credentials['apiKey'] = $credentials['apiKey'] ?? $tempAPIKey; + $credentials['projectId'] = $project->getId(); + $credentials['apiKey'] = $tempAPIKey; $credentials['endpoint'] = $endpoint; } } From e760a1386ba60747e1ffa70439037cabe199368a Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 15:51:41 +0200 Subject: [PATCH 16/24] Use credentials --- src/Appwrite/Platform/Workers/Migrations.php | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index f1b501d2be..03eddd872a 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -333,14 +333,11 @@ class Migrations extends Action $transfer = $source = $destination = null; - $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); - if (empty($endpoint)) { - throw new \Exception('_APP_MIGRATION_ENDPOINT env is empty'); - } +// $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); +// if (empty($endpoint)) { +// throw new \Exception('_APP_MIGRATION_ENDPOINT env is empty'); +// } - /** - * Overwrite env - */ $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $endpoint = $protocol . '://' . $platform['apiHostname'] . '/v1'; @@ -349,8 +346,6 @@ class Migrations extends Action if ($migration->getAttribute('source') === SourceAppwrite::getName()) { if (empty($credentials)) { - //$credentials['projectId'] = $credentials['projectId'] ?? $project->getId(); - //$credentials['apiKey'] = $credentials['apiKey'] ?? $tempAPIKey; $credentials['projectId'] = $project->getId(); $credentials['apiKey'] = $tempAPIKey; $credentials['endpoint'] = $endpoint; @@ -460,6 +455,7 @@ class Migrations extends Action // TODO: Move to CSV hook if ($migration->getAttribute('destination') === DestinationCSV::getName()) { + var_dump($migration); $this->handleCSVExportComplete($project, $migration, $queueForMails, $queueForRealtime, $platform, $authorization); } } @@ -493,6 +489,7 @@ class Migrations extends Action array $platform, Authorization $authorization, ): void { + $credentials = $migration->getAttribute('credentials', []); $options = $migration->getAttribute('options', []); $bucketId = 'default'; // Always use platform default bucket $filename = $options['filename'] ?? 'export_' . \time(); @@ -589,9 +586,7 @@ class Migrations extends Action // Generate download URL with JWT - $endpoint = System::getEnv('_APP_DOMAIN', ''); // Can use System::getEnv('_APP_MIGRATION_ENDPOINT'); ? - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled' ? 'https' : 'http'; - $downloadUrl = "{$protocol}://{$endpoint}/v1/storage/buckets/{$bucketId}/files/{$fileId}/push?project={$project->getId()}&jwt={$jwt}"; + $downloadUrl = "{$credentials['endpoint']}/storage/buckets/{$bucketId}/files/{$fileId}/push?project={$project->getId()}&jwt={$jwt}"; $options['downloadUrl'] = $downloadUrl; $migration->setAttribute('options', $options); $this->updateMigrationDocument($migration, $project, $queueForRealtime); From 05e1bb242f74ef649e72f65fc9b78108673b2736 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 15:52:29 +0200 Subject: [PATCH 17/24] stopOnFailure false --- phpunit.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpunit.xml b/phpunit.xml index 215ee2d59d..a8578995c1 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="true" + stopOnFailure="false" > From 3502cad4a5eedc996fdb4b3f1b9c769e450e5c3a Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 15:53:41 +0200 Subject: [PATCH 18/24] formatting --- .env | 2 +- src/Appwrite/Platform/Workers/Migrations.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 5f7a76d4ea..3755c064c5 100644 --- a/.env +++ b/.env @@ -131,4 +131,4 @@ _APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000 _APP_STATS_USAGE_DUAL_WRITING_DBS=database_db_main _APP_TRUSTED_HEADERS=x-forwarded-for _APP_POOL_ADAPTER=stack -_APP_MIGRATION_ENDPOINT=http://appwrite.test/v1 \ No newline at end of file +_APP_MIGRATION_ENDPOINT=http://appwrite.test/v1 diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 03eddd872a..b23e71cd15 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -333,10 +333,10 @@ class Migrations extends Action $transfer = $source = $destination = null; -// $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); -// if (empty($endpoint)) { -// throw new \Exception('_APP_MIGRATION_ENDPOINT env is empty'); -// } + // $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); + // if (empty($endpoint)) { + // throw new \Exception('_APP_MIGRATION_ENDPOINT env is empty'); + // } $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $endpoint = $protocol . '://' . $platform['apiHostname'] . '/v1'; From f530ec3db56c5b02b3128e5f7c65d693a6378d57 Mon Sep 17 00:00:00 2001 From: fogelito Date: Sun, 1 Feb 2026 15:57:30 +0200 Subject: [PATCH 19/24] Remove dbg --- src/Appwrite/Platform/Workers/Migrations.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index b23e71cd15..dd20bd9ec4 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -455,7 +455,6 @@ class Migrations extends Action // TODO: Move to CSV hook if ($migration->getAttribute('destination') === DestinationCSV::getName()) { - var_dump($migration); $this->handleCSVExportComplete($project, $migration, $queueForMails, $queueForRealtime, $platform, $authorization); } } From c1161ff27cf81f759221fcfa4f99891674058a38 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 2 Feb 2026 08:13:24 +0200 Subject: [PATCH 20/24] check isset --- src/Appwrite/Platform/Workers/Migrations.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index dd20bd9ec4..70b3ed7d97 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -345,11 +345,9 @@ class Migrations extends Action $credentials = $migration->getAttribute('credentials', []); if ($migration->getAttribute('source') === SourceAppwrite::getName()) { - if (empty($credentials)) { - $credentials['projectId'] = $project->getId(); - $credentials['apiKey'] = $tempAPIKey; - $credentials['endpoint'] = $endpoint; - } + $credentials['projectId'] = $credentials['projectId'] ?? $project->getId(); + $credentials['apiKey'] = $credentials['apiKey'] ?? $tempAPIKey; + $credentials['endpoint'] = $credentials['endpoint'] ?? $endpoint; } if ($migration->getAttribute('destination') === DestinationAppwrite::getName()) { From e9e51d5334c4f54bdec7b97f0e191d20328db184 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 2 Feb 2026 11:27:50 +0200 Subject: [PATCH 21/24] lock --- composer.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/composer.lock b/composer.lock index 6f8338a676..aff29676e0 100644 --- a/composer.lock +++ b/composer.lock @@ -283,16 +283,16 @@ }, { "name": "brick/math", - "version": "0.14.1", + "version": "0.14.3", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0" + "reference": "6af96b11de3f7d99730c118c200418c48274edb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/f05858549e5f9d7bb45875a75583240a38a281d0", - "reference": "f05858549e5f9d7bb45875a75583240a38a281d0", + "url": "https://api.github.com/repos/brick/math/zipball/6af96b11de3f7d99730c118c200418c48274edb4", + "reference": "6af96b11de3f7d99730c118c200418c48274edb4", "shasum": "" }, "require": { @@ -331,7 +331,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.1" + "source": "https://github.com/brick/math/tree/0.14.3" }, "funding": [ { @@ -339,7 +339,7 @@ "type": "github" } ], - "time": "2025-11-24T14:40:29+00:00" + "time": "2026-02-01T15:18:05+00:00" }, { "name": "chillerlan/php-qrcode", @@ -3615,16 +3615,16 @@ }, { "name": "utopia-php/audit", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/utopia-php/audit.git", - "reference": "8e0540aa939968418ee3ad2b2c305992a771e142" + "reference": "00b1d5c0fe7f912315598ee83278fe74d234b196" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/audit/zipball/8e0540aa939968418ee3ad2b2c305992a771e142", - "reference": "8e0540aa939968418ee3ad2b2c305992a771e142", + "url": "https://api.github.com/repos/utopia-php/audit/zipball/00b1d5c0fe7f912315598ee83278fe74d234b196", + "reference": "00b1d5c0fe7f912315598ee83278fe74d234b196", "shasum": "" }, "require": { @@ -3658,9 +3658,9 @@ ], "support": { "issues": "https://github.com/utopia-php/audit/issues", - "source": "https://github.com/utopia-php/audit/tree/2.1.0" + "source": "https://github.com/utopia-php/audit/tree/2.1.1" }, - "time": "2026-01-22T12:40:48+00:00" + "time": "2026-02-01T08:12:53+00:00" }, { "name": "utopia-php/auth", @@ -3961,16 +3961,16 @@ }, { "name": "utopia-php/database", - "version": "4.6.1", + "version": "4.6.4", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "8795a7f5bf8828955299ae44e5946f93a2b1bde5" + "reference": "4dfffd4d528f89b3b3fc09180d4c965ef9bdae30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/8795a7f5bf8828955299ae44e5946f93a2b1bde5", - "reference": "8795a7f5bf8828955299ae44e5946f93a2b1bde5", + "url": "https://api.github.com/repos/utopia-php/database/zipball/4dfffd4d528f89b3b3fc09180d4c965ef9bdae30", + "reference": "4dfffd4d528f89b3b3fc09180d4c965ef9bdae30", "shasum": "" }, "require": { @@ -4013,9 +4013,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/4.6.1" + "source": "https://github.com/utopia-php/database/tree/4.6.4" }, - "time": "2026-01-21T09:37:22+00:00" + "time": "2026-01-30T08:19:14+00:00" }, { "name": "utopia-php/detector", From 53b888672950cf0a47bcc4c8601bb7865a8745ec Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 2 Feb 2026 11:29:38 +0200 Subject: [PATCH 22/24] Remove env variable --- .env | 1 - docker-compose.yml | 1 - src/Appwrite/Platform/Workers/Migrations.php | 5 ----- 3 files changed, 7 deletions(-) diff --git a/.env b/.env index 3755c064c5..0f6ce2e896 100644 --- a/.env +++ b/.env @@ -131,4 +131,3 @@ _APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000 _APP_STATS_USAGE_DUAL_WRITING_DBS=database_db_main _APP_TRUSTED_HEADERS=x-forwarded-for _APP_POOL_ADAPTER=stack -_APP_MIGRATION_ENDPOINT=http://appwrite.test/v1 diff --git a/docker-compose.yml b/docker-compose.yml index 4fed970f5e..0eee94a999 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -818,7 +818,6 @@ services: - _APP_MIGRATIONS_FIREBASE_CLIENT_SECRET - _APP_DATABASE_SHARED_TABLES - _APP_OPTIONS_FORCE_HTTPS - - _APP_MIGRATION_ENDPOINT appwrite-task-maintenance: entrypoint: maintenance diff --git a/src/Appwrite/Platform/Workers/Migrations.php b/src/Appwrite/Platform/Workers/Migrations.php index 70b3ed7d97..1e2bace54b 100644 --- a/src/Appwrite/Platform/Workers/Migrations.php +++ b/src/Appwrite/Platform/Workers/Migrations.php @@ -333,11 +333,6 @@ class Migrations extends Action $transfer = $source = $destination = null; - // $endpoint = System::getEnv('_APP_MIGRATION_ENDPOINT'); - // if (empty($endpoint)) { - // throw new \Exception('_APP_MIGRATION_ENDPOINT env is empty'); - // } - $protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS') === 'disabled' ? 'http' : 'https'; $endpoint = $protocol . '://' . $platform['apiHostname'] . '/v1'; From 2e5b232e2b4e54b2495b6757fb0e51568e444660 Mon Sep 17 00:00:00 2001 From: fogelito Date: Mon, 2 Feb 2026 11:34:57 +0200 Subject: [PATCH 23/24] line --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 0f6ce2e896..ad973f24f9 100644 --- a/.env +++ b/.env @@ -130,4 +130,4 @@ _APP_PROJECT_REGIONS=default _APP_FUNCTIONS_CREATION_ABUSE_LIMIT=5000 _APP_STATS_USAGE_DUAL_WRITING_DBS=database_db_main _APP_TRUSTED_HEADERS=x-forwarded-for -_APP_POOL_ADAPTER=stack +_APP_POOL_ADAPTER=stack \ No newline at end of file From 52174816b2e45319311e5b92062c5f61570bfbe5 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 2 Feb 2026 15:39:12 +0530 Subject: [PATCH 24/24] chore: update messaging worker logging --- src/Appwrite/Platform/Workers/Messaging.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Appwrite/Platform/Workers/Messaging.php b/src/Appwrite/Platform/Workers/Messaging.php index ae94c7580d..7b604c3b19 100644 --- a/src/Appwrite/Platform/Workers/Messaging.php +++ b/src/Appwrite/Platform/Workers/Messaging.php @@ -129,6 +129,11 @@ class Messaging extends Action $userIds = $message->getAttribute('users', []); $providerType = $message->getAttribute('providerType'); + Console::log(json_encode([ + 'project' => $project->getId(), + 'type' => $providerType, + ])); + /** * @var array $allTargets */ @@ -400,7 +405,10 @@ class Messaging extends Action throw new \Exception('Project not set in payload'); } - Console::log('Processing project: ' . $project->getId()); + Console::log(json_encode([ + 'project' => $project->getId(), + 'type' => 'internal-sms' + ])); $denyList = System::getEnv('_APP_SMS_PROJECTS_DENY_LIST', ''); $denyList = explode(',', $denyList); if (\in_array($project->getId(), $denyList)) {