Mosh Ontong
I run my function through domain and console but still received this kind of error
My function code:
TypeScript
// This is your Appwrite function
// It's executed each time we get a request
export default async ({ req, res, log, error }: any) => {
// Why not try the Appwrite SDK?
const headers = req.headers;
log(JSON.stringify(headers));
// const client = new Client()
// .setEndpoint("https://cloud.appwrite.io/v1")
// .setProject(Bun.env["APPWRITE_FUNCTION_PROJECT_ID"])
// .setKey(headers["DDC_SECRET_KEY"]);
// const databases = new Databases(client);
// // The `req` object contains the request data
// if (req.method === "GET") {
// const response = await databases.getDocument(
// "65a389d70bee25715a29",
// "65a85181f26b3b9f9232",
// headers["taramed-patient-id"]
// );
// return res.json({
// patientInfo: {
// firstName: response["firstName"],
// lastName: response["lastName"],
// dateOfBirth: response["dateOfBirth"],
// gender: response["gender"],
// address: response["address"],
// weight: response["weight"],
// weightUnit: response["weightUnit"],
// },
// vitalSigns: {
// heartRate: response["heartRate"],
// bloodPressure: response["bloodPressure"],
// respiratoryRate: response["respiratoryRate"],
// temperature: response["bodyTemperature"],
// },
// });
// }
// `res.json()` is a handy helper for sending JSON
return res.json({
motto: "Build like a team of hundreds_",
learn: "https://appwrite.io/docs",
connect: "https://appwrite.io/discord",
getInspired: "https://builtwith.appwrite.io",
});
};
TL;DR
The developer received an error when running their function through a domain and console. They shared their function code which includes commented out sections. They were trying to use the Appwrite SDK and make a GET request to retrieve data from a database, but the code is currently commented out. In the end, they are returning a JSON response with some key-value pairs. There is no solution mentioned in the thread. Mosh Ontong
[SOLVED]
ideclon
What happened?
Recommended threads
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...
- Get team fail in appwrite function
I try to get team of a user inside appwrite function, but i get this error: `AppwriteException: User (role: guests) missing scope (teams.read)` If i try on cl...
- Function in Node.JS to monitor events ar...
Hello everyone. I'm creating my first Node.JS function, but I don't have much experience with node and javascript. I'm trying to create a function, that monito...