Back

[SOLVED] Refreshing a page gives me the following error:

  • 0
  • Accounts
  • Web
RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 02:11

Just as the title states when I refresh a page it gives me this erro:

TypeScript
AppwriteException: User (role: guests) missing scope (account)
    at Client.<anonymous> (file:///C:/Users/meera/GithubDesktop/AIC-Dismissal/node_modules/appwrite/dist/esm/sdk.js:391:27)
    at Generator.next (<anonymous>)
    at fulfilled (file:///C:/Users/meera/GithubDesktop/AIC-Dismissal/node_modules/appwrite/dist/esm/sdk.js:22:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 401,
  type: 'general_unauthorized_scope',
  response: {
    message: 'User (role: guests) missing scope (account)',
    code: 401,
    type: 'general_unauthorized_scope',
    version: '0.12.30'
  }
}

But when I navigate to the same page the error is not there... when I refresh the same page it gives me that error.

TL;DR
When refreshing the page, the user encounters a "User (role: guests) missing scope (account)" error. The error is related to SSR (Server-Side Rendering) and can be resolved by using JWT tokens or manually creating a session server-side. The user mentions a temporary fix using SvelteKit. The thread suggests checking the network logs and verifying if the fallback header is set or if the session cookie is included in the request. The error is not present when navigating to the page without refreshing. No specific solution or further details are provided in the thread.
Drake
29 Dec, 2023, 02:28

Do you have a session already or not?

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 02:28

yes

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 02:28

I do have a session

Drake
29 Dec, 2023, 02:41

Can you check the network logs off the request and check that the fallback header is set or the cookie is included in the rest?

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:30

what do you mean?

Drake
29 Dec, 2023, 03:31

Switch to the network tab instead of the console tab

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:39

ehre u go:

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:39
RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:40
RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:41

this is the cookie

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:41
Drake
29 Dec, 2023, 03:54

This is a 500 error from your app, not the 401 account.get()

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:55

thats the only error

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:55

thats showing up

Drake
29 Dec, 2023, 03:55

Do you have any filters applied?

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:55

nope

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:56

I managed to get a temporary fix by checking the browiser using sveltekit

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 03:56

but do you know how to persist the session on the server

Drake
29 Dec, 2023, 03:59

honestly, i recommend staying away from SSR because it adds complexity.

if you really want to continue using SSR, you'll either need to use JWT tokens or manually create a session server side so you can extract the session cookie from the header and fully manage it yourself (demo: https://svelte-kit.ssr.almostapps.eu/).

We do have plans to improve SSR with Appwrite which can be found here: https://github.com/appwrite/rfc/pull/59

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 04:03

alright thank you!

RangerDev πŸ”»πŸ”»πŸ”»πŸ”»
29 Dec, 2023, 04:03

[SOLVED] Refreshing a page gives me the following error:

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