Back

Files access permissions error

  • 0
  • Self Hosted
  • Web
  • Storage
kesha
30 Sep, 2024, 17:42

So, I have the same problem as described here. The authentication setup follows this Appwrite tutorial.

Unlike the person from the topic above, I have a self-hosted Appwrite instance.

Here are the versions I’m using:

TypeScript
Appwrite 1.6
Nuxt 3.12
Node 20.16
Latest Appwrite SDKs

Authentication works fine on its own, but when I try to access a file that has read(users) permissions, I get an error.

I have an a_session cookie for the domain (I’ve tried different setups, e.g., localhost for both the frontend and self-hosted Appwrite, as well as Appwrite on stage-api.domain.com and the frontend on domain.com using the hosts file).

The cookies (a_session and a_session_console) are attached to the GET request, but the result is always the same: a 404 error, stating “you don’t have permissions”. Third-party cookies are enabled as well.

What else should I check? Sorry for duplicating the topic, but I still haven’t found a solution.

TL;DR
Developers are facing file access permission errors in a self-hosted Appwrite instance despite following the Nuxt SSR Auth tutorial. Even with the correct cookies attached to the request, they keep receiving a 404 error for lack of permissions. Third-party cookies are enabled. Solution: Review CORS settings, check file permissions, and verify cookie domain and path configurations.
Steven
30 Sep, 2024, 20:09

Look at the network logs in the browser for the request. See if the cookie is included in the headers or the cookies tab

kesha
1 Oct, 2024, 05:06

they are included, as i was mentioned. in every request

kesha
1 Oct, 2024, 12:26

yup )

kesha
1 Oct, 2024, 15:26

I replaced parts of cookies with multidots just to make message shorter

TypeScript
  "headers": {
    "accept": "image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8",
    "accept-language": "en,zh-CN;q=0.9,zh;q=0.8,ru;q=0.7,ko;q=0.6,en-GB;q=0.5,en-US;q=0.4,uk;q=0.3,pt;q=0.2",
    "cache-control": "no-cache",
    "pragma": "no-cache",
    "priority": "u=2, i",
    "sec-ch-ua": "\"Microsoft Edge\";v=\"129\", \"Not=A?Brand\";v=\"8\", \"Chromium\";v=\"129\"",
    "sec-ch-ua-mobile": "?0",
    "sec-ch-ua-platform": "\"macOS\"",
    "sec-fetch-dest": "image",
    "sec-fetch-mode": "no-cors",
    "sec-fetch-site": "same-site",
    "cookie": "a_session_666b23d5000a5c016b0f_legacy=eyJpZCI6IjY2NzA2NWE1.........iOTUxYWVlYTlhMTkzMDc2MGI0MjZhYzliM2QwYWVlNzJkNDBmYTNlODU3YmJlYTYzODMyZWI3MGJlYiJ9; a_session_666b23d5000a5c016b0f=eyJpZCI6Ij.........VlYTlhMTkzMDc2MGI0MjZhYzliM2QwYWVlNzJkNDBmYTNlODU3YmJlYTYzODMyZWI3MGJlYiJ9; a_session_console_legacy=eyJpZCI6IjY0OTMx..........QxZTJlNTc2MTQ5YmJmYTAyNGVjZmMxNDFkM2UxYjFjYTM5NGM2OThlMDY1YyJ9; a_session_console=eyJpZCI6IjY0OTMxZTllM2E3YmI1Z..........JlNTc2MTQ5YmJmYTAyNGVjZmMxNDFkM2UxYjFjYTM5NGM2OThlMDY1YyJ9; a_session_65255b5e286c4a640594_legacy=eyJpZCI6IjY1OGQ1.........YzJhZDZlNWZiYTcyNjJmOTQ4YzAzZWM1Mzg2MjA4ODkxNTFlMzNlNGE2Mjc1MDZjNmQ5MDVmYSJ9; a_session_65255b5e286c4a640594=eyJpZCI6IjY1OGQ.........2Mjc1MDZjNmQ5MDVmYSJ9",
    "Referer": "https://travel.bitstarzhub.com:3000/",
    "Referrer-Policy": "strict-origin-when-cross-origin"
  },
  "body": null,
  "method": "GET"
});```
kesha
1 Oct, 2024, 15:34

i also tried different options in platform settings e.g *, *domain.com. subdomian.domain.com etc

Steven
1 Oct, 2024, 19:28

Deleting sensitive cookies

Steven
1 Oct, 2024, 19:30

Do you have anything in front of your Appwrite instance?

kesha
2 Oct, 2024, 05:59

they were not sensitive, but thanks.

kesha
2 Oct, 2024, 06:00

no, nothing. no cloudflare or smth similar. pure nuxt js on local side and aws vps on appwrite

Steven
2 Oct, 2024, 23:17

So you got this by looking at the browser developer tools and copying the request as fetch?

You're saying this request returned 404

kesha
3 Oct, 2024, 04:42

yes, devtools, copy as fetch. yes, 404 also if i'm trying to visit direct link i have

TypeScript
    "message": "The requested file could not be found.",
    "code": 404,
    "type": "storage_file_not_found",
    "version": "1.6.0"
}```
and i'm sure that file is exist, coz it works with &mode=admin
kesha
3 Oct, 2024, 04:44

and permissions is correct also

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