Back

Problems with creation of Relationship Attribute

  • 0
  • Databases
kirusha
9 Oct, 2023, 15:56

i have a script written in dart for creation of db for a project.

`` class Env { static String get APPWRITE_URL => ''; static String get APPWRITE_PROJECT_ID => 'smash'; static String get APPWRITE_DB => 'smash_db';

static String get APPWRITE_HOBBIES_COLLECTION => 'hobbies'; static String get APPWRITE_SMASH_COLLECTION => 'smashes'; static String get APPWRITE_PASS_COLLECTION => 'passes'; static String get APPWRITE_FRIENDS_COLLECTION => 'friends'; static String get APPWRITE_MEDIA_COLLECTION => 'media'; static String get APPWRITE_USERS_COLLECTION => 'users'; static String get APPWRITE_CHAT_COLLECTION => 'chat'; static String get APPWRITE_BLOCK_COLLECTION => 'blocks'; static String get APPWRITE_SUPPORT_COLLECTION => 'support'; static String get APPWRITE_REPORTS_COLLECTION => 'reports';

static String get APPWRITE_MEDIA_BUCKET => 'media'; static String get APPWRITE_DELETE_AUTH_FUNCTION => ''; static int get APPWRITE_QUERY_LIMITED => 8999999999999999999; static int get APPWRITE_DAILIES_LIMITED => 5; } ``

my problem is: that i get errors with this two: `` await AppwriteService.databases.createRelationshipAttribute( databaseId: Env.APPWRITE_DB, collectionId: Env.APPWRITE_USERS_COLLECTION, relatedCollectionId: Env.APPWRITE_SMASH_COLLECTION, key: 'smashes', type: 'oneToMany', twoWay: true, twoWayKey: 'from', onDelete: 'cascade', );

await AppwriteService.databases.createRelationshipAttribute( databaseId: Env.APPWRITE_DB, collectionId: Env.APPWRITE_USERS_COLLECTION, relatedCollectionId: Env.APPWRITE_PASS_COLLECTION, key: 'passes', type: 'oneToMany', twoWay: true, twoWayKey: 'from', onDelete: 'cascade', ); ``

i dont know why

TL;DR
The user is experiencing problems with creating a relationship attribute in their project. They are unsure how to troubleshoot or find more details about the issue. The error they receive is related to Appwrite not being connected to any domain or resource. The user asks for clarification on how to find more details about the error and shares a Dart script they wrote for creating the database. They specifically mention issues with creating the relationship attributes for the 'smashes' and 'passes' collections. Solution: The user can use network logs from the browser dev tools to look at the list collection API call's response to find the relevant attribute and share that section.
Drake
9 Oct, 2023, 18:31

FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting.

Drake
9 Oct, 2023, 18:37

what is the error?

kirusha
10 Oct, 2023, 11:56

i'm not sure. bc. there is no error in appwrite docker log.

kirusha
10 Oct, 2023, 16:47

or is there a different way to look for more details

D5
10 Oct, 2023, 17:59

are you 100% sure?

D5
10 Oct, 2023, 17:59

What do you get after running this command in your appwrite installation folder? docker compose logs appwrite

kirusha
10 Oct, 2023, 18:02

[Error] Method: GET [Error] URL: /console/* [Error] Type: Appwrite\Extend\Exception [Error] Message: This domain is not connected to any Appwrite resource yet. Please configure custom domain or function domain to allow this request. [Error] File: /usr/src/code/app/controllers/general.php [Error] Line: 67

that was the log after docker compose up -d, and if i try to add this relationship there is no log for it.

kirusha
10 Oct, 2023, 18:04

Collection A:

  • b: which is ref to Collection B

Collection B:

  • a: which is a two way ref to Collection A

....

maybe this is the problem.

D5
10 Oct, 2023, 18:04

What appwrite version you're using?

kirusha
10 Oct, 2023, 18:04

1.4.4

kirusha
10 Oct, 2023, 18:05

up there is my script. if u run it, u should be able to reproduce the problem.

Drake
10 Oct, 2023, 18:18

you could look at the logs from the appwrite-worker-databases container

Drake
12 Oct, 2023, 18:22

Uhh can you search through this for the relevant attribute and only share that section?

Drake
12 Oct, 2023, 18:23

Another option is to use the network logs from the browser dev tools to look at the list collection API call's response. The attribute should have the error message

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