Web Developer
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.