appwrite/appwrite

๐Ÿ› Bug Report: Unable to get current user session on functions using jwt

Open

#8,174 opened on May 21, 2024

View on GitHub
ย (17 comments)ย (0 reactions)ย (1 assignee)TypeScriptย (5,346 forks)batch import
bughelp wantedproduct / auth

Repository metrics

Stars
ย (56,074 stars)
PR merge metrics
ย (Avg merge 3d 3h)ย (162 merged PRs in 30d)

Description

๐Ÿ‘Ÿ Reproduction steps

            import { Client} from 'node-appwrite';
            const userClient = new Client();
            const userAccount = new Account(userClient);

            userClient.setEndpoint(FUNCTIONS_END_POINT)
                .setProject(PROJECT_ID)
                .setJWT(x-appwrite-user-jwt);

            const currentSession = await userAccount.getSession('current');

๐Ÿ‘ Expected behavior

getSession('current') should return the current user session that is being used.

๐Ÿ‘Ž Actual Behavior

Fails with user_session_not_found error.

{"code":404,"type":"user_session_not_found","response":{"message":"The current user session could not be found."...}},

๐ŸŽฒ Appwrite version

Appwrite Cloud

๐Ÿ’ป Operating system

Linux

๐Ÿงฑ Your Environment

1.5.5

๐Ÿ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

๐Ÿข Have you read the Code of Conduct?

Contributor guide