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
- general_route_not_found - Auth Guide
If you’ve just added a subdomain to your project, verified your DNS records, and confirmed your SSL certificate is working, but you're still hitting a `general_...
- Can't resume paused project
I have logged in in incognito, done the email verification and still get the invalid fingerprint error. What's the issue.
- Download appwrite Docs
Is there is a way to download appwrite Docs ? Because appwrite skill isn't enough to give the agent full understanding about how appwrite works (I noticed this ...