Server: `import { Client, Account } from 'node-appwrite';
export default async function (req, res, log, error) { try {
const userClient = new Client()
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('xxx') // Your project ID
.set(req.headers.authorization); // The user session to authenticate with
const account = new Account(userClient);
const result = await account.get();
res.status(200).json({ success: true });
} catch (err) { res.status(400).json({ success: false, error: e.message }); } }`
Client: ` const session = await account.getSession('current'); const jwt = await account.createJWT();
const response = await functions.createExecution(
'', // Function ID
'', // Body (optional)
false, // Async (optional)
undefined, // Path (optional)
ExecutionMethod.GET, // HTTP method (optional)
{ 'Authorization': `Bearer ${jwt.jwt}` }, // Headers (optional)
undefined
);`
Error: TypeError: Cannot read properties of undefined (reading 'status')
I want to retrieve the server-side information of a user who has logged in from the client and return it, but I'm having trouble doing so.
FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting).
Where did you get the Client()[…].set() syntax from?
The error seems to be on your res.status(…)
(i.e., .status() not being a valid method of res)
I need some more help with this. I checked if the res object is being passed correctly, but I'm still getting the same error. Could you help me with this?
You’ve confirmed that res.status() is a valid method? How did you do that?
Recommended threads
- Project auto-blocked after load testing ...
Hi team 👋 My project has been automatically blocked with the message: "Project is currently blocked — Access to this project is restricted. Contact support if...
- App build crashing with "Internal error"
Hello Appwrite team! 👋 We are trying to deploy a Next.js application on Appwrite Cloud, but our builds are consistently failing. The deployment log successful...
- education plan not activated
Hi I have an edu id 13103046@iubat.edu but when I am trying to claim my plan and trying to logging with github where education student plan active. the appwrite...