Back

Failed to fetch

  • 0
  • Databases
  • Web
Richard Trudel
27 Feb, 2023, 06:23

I get this message in the console when I try to open a specific document in the control panel. I even try to unregister the service worker, for some reason, it do not open, if I refresh I get a blank screen. So no way to even delete the document from the UI. Did I missed something?

TL;DR
The user is experiencing a 'Failed to fetch' error when trying to open a specific document in the control panel. They are unsure of the cause and have tried various troubleshooting steps. They suspect that redundant permissions in the code may be the issue. They are seeking help to resolve the problem. No solution is provided in the support thread.
Richard Trudel
27 Feb, 2023, 06:24

This may help?

Richard Trudel
27 Feb, 2023, 06:25

Failed to fetch

Richard Trudel
27 Feb, 2023, 06:57

I may know what happened. If I'm right, a small validation fix may be required.

When I created the document, I used this code in permissions:

TypeScript
Permission.read(Role.team(currentTeamId)),
Permission.update(Role.team(currentTeamId)),
Permission.delete(Role.team(currentTeamId)),
Permission.read(Role.team('admin')),
Permission.update(Role.team('admin')),
Permission.delete(Role.team('admin')),

in that very case, currentTeamId was equal to 'admin' which resulted in redundant permissions. This could cause the fetch problem?

Richard Trudel
27 Feb, 2023, 07:01

To avoid that, I had to use something like:

TypeScript
permissions = [];
permissions.push(Permission.read(Role.team(currentTeamId)));
permissions.push(Permission.update(Role.team(currentTeamId)));
permissions.push(Permission.delete(Role.team(currentTeamId)));
if (currentTeamId!=='admin'){
  permissions.push(Permission.read(Role.team('admin')));
  permissions.push(Permission.update(Role.team('admin')));
  permissions.push(Permission.delete(Role.team('admin')));
}

but... I think this is overkill to do have to do this, isn't? 🙂

Richard Trudel
27 Feb, 2023, 07:04

Perhaps it's only a GUI problem too, as everything works fine in my app, it's only in the Appwrite control panel I can't open the document. Anyway, I'll try to delete all "broken" documents from my app, this is the next CRUD part I have to code.

Drake
27 Feb, 2023, 07:16

Can you check what the get document API returns from the network logs in the browser dev tools?

Richard Trudel
27 Feb, 2023, 07:20

Ah, I should check... i now have deleted them all using the SDK...

Richard Trudel
27 Feb, 2023, 07:20

I will try to reproduce

Richard Trudel
27 Feb, 2023, 07:25

I reverted my code but I seems cannot be able to reproduce the problem... it's embarassing hehe if I see it again, I'll look in the network pane and I'll re-open the post here.

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