Back

[SOLVED] Failing to get related data with Refine's Appwrite adapter

  • 0
  • Self Hosted
Onder
30 Jul, 2024, 19:46

Hello,

I'm failing to get related data when Refine queries my Appwrite collection. Below is the request sent by Refine

TypeScript
fetch("https://***/v1/databases/catalog/collections/66a91c86002e92cde00c/documents?queries%5B0%5D=offset%280%29&queries%5B1%5D=limit%2825%29", {
  "headers": {
    "accept": "*/*",
    "accept-language": "en-US,en;q=0.9,tr;q=0.8",
    "content-type": "application/json",
    "priority": "u=1, i",
    "sec-ch-ua": "\"Not)A;Brand\";v=\"99\", \"Microsoft Edge\";v=\"127\", \"Chromium\";v=\"127\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"Windows\"",
    "sec-fetch-dest": "empty",
    "sec-fetch-mode": "cors",
    "sec-fetch-site": "cross-site",
    "x-appwrite-project": "***",
    "x-appwrite-response-format": "1.0.0",
    "x-fallback-cookies": "{\"a_session_66a8eab300012a42b37c\":\"***\"}",
    "x-sdk-language": "web",
    "x-sdk-name": "Web",
    "x-sdk-platform": "client",
    "x-sdk-version": "10.2.0"
  },
  "referrer": "http://localhost:5173/",
  "referrerPolicy": "strict-origin-when-cross-origin",
  "body": null,
  "method": "GET",
  "mode": "cors",
  "credentials": "include"
});

Please let me know if more info needed

TL;DR
Developers were struggling to retrieve related data using Refine's Appwrite adapter. The issue was due to missing permissions for the category collection. The solution involved ensuring that related items had appropriate permissions and checking the Appwrite SDK version compatibility. The problem was eventually resolved by updating the package to the latest version.
Onder
30 Jul, 2024, 19:47

@Kenny

Kenny
30 Jul, 2024, 19:49

Is there a reason you're using the 10.x SDK? it looks like it's 2 years old and meant for appwrite 1.0.0?

Kenny
30 Jul, 2024, 19:50

What version of Appwrite on you on?

Onder
30 Jul, 2024, 19:52

I'm on Appwrite 1.5.7 version currently. Actually this is a different package @refinedev/appwrite maintained by Refine team but it's not updated to latest version

Onder
30 Jul, 2024, 19:55

but actually they are using quite simple methods to build a data provider out of Appwrite, I can imitate their way to port their package to the Appwrite 1.5

Kenny
30 Jul, 2024, 19:56

Sheesh. Not sure how backwards compatible Appwrite is, that could be your issue. Otherwise, like I said in general, relationships should come by default unless you've not selected them using Query.select

Onder
30 Jul, 2024, 19:56

Thanks. I will test the latest appwrite sdk and see how can I port it

Kenny
30 Jul, 2024, 19:56

Wait, does your related item have permissions?

Onder
30 Jul, 2024, 19:56

you're good

Onder
30 Jul, 2024, 19:56

wait please

Onder
30 Jul, 2024, 19:57

that was exactly it!

Kenny
30 Jul, 2024, 19:57

:P Awesome

Onder
30 Jul, 2024, 19:57

category collection had no perms to the all users

Onder
30 Jul, 2024, 19:58

thanks a lot, you eased a lot of pain

Onder
30 Jul, 2024, 19:58

but they still have to update their package

Onder
30 Jul, 2024, 19:58

i'll talk to them, even i may create a PR for them

Onder
30 Jul, 2024, 19:58

thanks again!

Kenny
30 Jul, 2024, 19:59

[SOLVED] Failing to get related data with Refine's Appwrite adapter

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