![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
nothing changed. I am still wondering about additional cors setting that I could have messed up
![](https://cdn.discordapp.com/avatars/796164927034359808/318b9f408f57114c9605b8d3b30fd499.webp)
If CORS were the issue, you wouldn't be getting any response. But you are receiving a response from Appwrite
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Null or user makes much more sense to me. Otherwise, you have to check if an id is an empty string or something like that
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
okay, since I am wondering since I do get a 401 response in the console
06:20:59.845 XHRGET
http://localhost/v1/account
[HTTP/1.1 401 Unauthorized 6ms]
GET
http://localhost/v1/account
Status
401
Unauthorized
VersionHTTP/1.1
Übertragen4,00 kB (8,45 kB Größe)
Referrer Policystrict-origin-when-cross-origin
DNS-AuflösungSystem
Access-Control-Allow-Credentials
true
Access-Control-Allow-Headers
Origin, Cookie, Set-Cookie, X-Requested-With, Content-Type, Access-Control-Allow-Origin, Access-Control-Request-Headers, Accept, X-Appwrite-Project, X-Appwrite-Key, X-Appwrite-Locale, X-Appwrite-Mode, X-Appwrite-JWT, X-Appwrite-Response-Format, X-Appwrite-Timeout, X-SDK-Version, X-SDK-Name, X-SDK-Language, X-SDK-Platform, X-SDK-GraphQL, X-Appwrite-ID, X-Appwrite-Timestamp, Content-Range, Range, Cache-Control, Expires, Pragma
Access-Control-Allow-Methods
GET, POST, PUT, PATCH, DELETE
Access-Control-Allow-Origin
http://localhost:5173
Access-Control-Expose-Headers
X-Fallback-Cookies
Cache-Control
no-cache, no-store, must-revalidate
Content-Encoding
br
Content-Length
2990
Content-Type
application/json; charset=UTF-8
Date
Mon, 18 Dec 2023 05:20:59 GMT
Expires
0
Pragma
no-cache
Server
Appwrite
X-Content-Type-Options
nosniff
X-Debug-Fallback
true
X-Debug-Speed
0.0024588108062744
Accept
*/*
Accept-Encoding
gzip, deflate, br
Accept-Language
de,en-US;q=0.7,en;q=0.3
Connection
keep-alive
content-type
application/json
Host
localhost
Origin
http://localhost:5173
Referer
http://localhost:5173/
Sec-Fetch-Dest
empty
Sec-Fetch-Mode
cors
Sec-Fetch-Site
same-site
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
okay will change it later . Thank you for your input
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
What makes you think there's a cors problem?
![](https://cdn.discordapp.com/avatars/796164927034359808/318b9f408f57114c9605b8d3b30fd499.webp)
The User (role: guests) missing scope (account)
in the Exception is coming from the Appwrite backend
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Which is expected if you're not logged in
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
just guessing around.
![](https://cdn.discordapp.com/avatars/796164927034359808/318b9f408f57114c9605b8d3b30fd499.webp)
Just pointing out that it can't be CORS
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
You would get a CORS error if there's a CORS problem so if you're not seeing that, there's no CORS problem
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
okay. but why does my catch block not work for the exception?
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
What's your latest code now?
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
this was the attempt removing all other code from a the catch block with account.get inside the context itself is still the same
export async function getCurrentUser() {
var activeAccount = null;
try {
activeAccount = await account.get();
if (!activeAccount) {
throw new Error("get active Account failed");
}
console.log("activeAccount", activeAccount.$id);
} catch (error: any) {
console.log("account.get error: " + error);
return error as AppwriteException;
}
try {
const activeUser = await databases.listDocuments(
conf.APPWRITE_DATABASE_PLANER,
conf.APPWRITE_USERCOLLECTION_ID,
[Query.equal("accountID", activeAccount.$id)]
);
if (!activeUser) {
throw new Error("User not found in Collection");
}
console.log("activeuser", activeUser);
return activeUser.documents[0];
} catch (error: any) {
console.log("getcurrentUser error: " + error);
return error as AppwriteException;
}
}
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
I still think you need to clean this up based on what I said earlier...but anyways, please share a screenshot of the logs from the browser
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
the double log entrys come from strict mode
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
It's going to the catch block...that log is from the catch block...
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
oh ...
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
I am far over my uptime. I think I need to go to sleep
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
but the attempt to call the get() triggers the error log?
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Yes. Whenever there's a network request with a 400+ status code, the browser will log it. Regardless of whether you catch it or not
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
hmm okay. I understand that I wasted your time, but I am thankfull for your help.
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
No worries at all. Nothing is wasted as long as you've learned something
![](https://cdn.discordapp.com/avatars/796164927034359808/318b9f408f57114c9605b8d3b30fd499.webp)
If your issue has been solved, you can mark this post as closed by adding “[SOLVED]” to the beginning of the title
![](https://cdn.discordapp.com/avatars/137245366520119297/0fc1aa7b487c6665da96653fdc33f3a1.webp)
[SOLVED] AppwriteException: User (role: guests) missing scope (account)
Recommended threads
- Why is the size of node-appwrite so much...
- AppwriteException: Rate limit for the cu...
AppwriteException: Rate limit for the current endpoint has been exceeded. Please try again after some time. How long time is it usually? Can i turn it off? I am...
- Migrate from 1.4.3 to 1.5.7
Hello, I am going to migrate from 1.4.3 to 1.5.7. Is there anything I should take into account to avoid errors? Can I do it directly or do I need to upload vers...
![](/images/bgs/pre-footer.png)