appwrite icon indicating copy to clipboard operation
appwrite copied to clipboard

🐛 Bug Report: Server Error (500) and "Unknown attribute: 'owner'" when adding custom domain in self-hosted Appwrite

Open MeghdadHadidi opened this issue 7 months ago • 2 comments

👟 Reproduction steps

  • Go to Appwrite Console.
  • Navigate to Project > Domains.
  • Attempt to add a custom domain (e.g., mydomain.com).
  • Sometimes get a 500 Server Error or 400 error ("This domain is not allowed...").
  • Observe error in Docker logs as above.

Here's the error detail:

Utopia\Database\Exception\Structure: Invalid document structure: Unknown attribute: "owner"
File: /usr/src/code/vendor/utopia-php/database/src/Database/Database.php
Line: 3653

I also attached a screenshot from docker logs of the running appwrite service

Image

👍 Expected behavior

Custom domain should be added, or clear validation message if domain is not allowed, but should not throw an "Unknown attribute: 'owner'" error or cause a 500 internal server error.

👎 Actual Behavior

When I try to add a custom domain in my self-hosted Appwrite instance (via the Console UI), I sometimes receive a 500 Server Error for some domains, or a 400 error stating "This domain is not allowed..." for others.

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

Linux

🧱 Your Environment

  • Appwrite version: 1.7.4 (the same with 1.7.0)
  • Deployment: Self-hosted (Docker)
  • OS: Ubuntu 24.04

👀 Have you spent some time to check if this issue has been raised before?

  • [x] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

MeghdadHadidi avatar May 29 '25 23:05 MeghdadHadidi

Hi @MeghdadHadidi ,

I had the same problem after updating to 1.7.4. I was able to trace it back to the migration not running correctly.

I suspect it has to do with this commit from a month ago, where the missing attributes were added to Migration V21 (migration for 1.6). Since I had set up my 1.6 installation before that, these attributes weren't created at the time. Consequently, they're missing when updating to 1.7, as Migration V21 doesn't run again.

I solved the problem on my end by manually running the migration for 1.6 first, and then migrating to 1.7 as usual.

docker compose exec appwrite migrate --version=1.6.0

docker compose exec appwrite migrate

The problem no longer occurs for me. BUT you should definitely create a backup of your database before - in case the down-migration causes any data corruptions or other issues.

lukas-heinrich avatar Jun 01 '25 17:06 lukas-heinrich

Manually running the 1.6 migration before upgrading to 1.7 did the trick Really appreciate you sharing this @lukas-heinrich saved me a lot of time! 🙌

MeghdadHadidi avatar Jun 01 '25 21:06 MeghdadHadidi