
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.
[SOLVED]

What happened?
Recommended threads
- phantom relationships appear on parent c...
i have this bug were my past deleted collection apears as relationship to my parent collection. when i try to delete that relationship from parent it gives me e...
- Attributes Problem - Cloud
I am not able to see the attribute columns and their context on cloud. Can you help?
- Authorization header not working in Appw...
I have an Appwrite function that takes a custom bearer token as authentication. The function works fine locally when I test it with `appwrite run functions`, bu...
