Back

dev code works production code breaks

  • 0
  • Self Hosted
  • Databases
BloodThermic
7 Mar, 2024, 01:53
TypeScript
                    "646587b51b84a01f2ba8",
                    response.$id,
                    "collectionId",
                    "fulltext",
                    ["collectionId"],
                    ["ASC"]
                );```

works for localhost but when built into production it breaks and does not create attribute.
TL;DR
Production code breaks because the attribute `collectionId` is not available. Works fine on localhost. Problem arises in production. Solution: Change `"collectionId"` in the `databases.createIndex` method to the correct attribute name to fix the issue.
BloodThermic
7 Mar, 2024, 01:53

It works fine when hosted in preview on localhost but when its pushed to server it breaks

Evdog
7 Mar, 2024, 01:57

What's the error?

BloodThermic
7 Mar, 2024, 01:58
TypeScript
[Error] Timestamp: 2024-03-07T01:40:41+00:00
[Error] Method: POST
[Error] URL: /v1/databases/:databaseId/collections/:collectionId/indexes
[Error] Type: Appwrite\Extend\Exception
[Error] Message: Attribute not available: collectionId
[Error] File: /usr/src/code/app/controllers/api/databases.php
[Error] Line: 2486
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