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

πŸ‘Ÿ 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?

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

Hi @stnguyen90

I will unassign myself from this issue due to upcoming commitments that will require my full attention. I apologize for any inconvenience this may cause and appreciate your understanding. It has been a pleasure contributing to Appwrite, and I look forward to contributing again in the future when my schedule allows.

No worries at all! Feel free to come back when you find the time πŸ‘‹πŸΌ

@Souptik2001, assigned! Thanks for your interest! πŸ™πŸΌ

@nickaldwin, the sooner the better. Please keep us updated on your progress. Otherwise, I’ll need to unassign you.

@nickaldwin, have you looked through these docs?

That said, you don’t even need to use an Appwrite function for this. You should be able to use a client SDK to

  1. Create an email password session
  2. Create a JWT token

Then, use a server SDK to set the JWT token and call Get session using β€œcurrent” as the ID