I have a simple function that gets the transcriptId param but for some reason I get TypeError: error is not a function? I thought this is how your supposed to use error and log?
TypeScript
import { Client, Databases } from 'node-appwrite';
import { throwIfMissing } from './utils.js';
export default async ({ req, res, log, error }) => {
try {
if (req.method === 'GET') {
const transcriptId = req.bodyJson.transcriptId;
if (!transcriptId) {
error("Missing transcriptId parameter");
return res.json({ error: "Missing transcriptId" }, 400);
}
} else {
return res.json({ error: "Method not allowed" }, 405);
}
} catch (e) {
error("Function error:", e);
return res.json({ error: "Internal server error: " + e.message }, 500);
}
};
TL;DR
Issue: Error is demonstrating as not a function in the code.
Solution: The 'error' function should be accessed through the 'context' property. Modify the code to use `context.error()` instead of just 'error'.In the logs, it does say to use context.log() or context.error() but how would I get the context property?
Recommended threads
- Function for long running task (other 60...
My function need long running other 60 seconds. But async mode return empty body. How to deal with that please ?
- total parameter not working correctly in...
Hello Appwrite team, I'm experiencing issues with the total parameter in the listRows() method (TablesDB) across multiple SDKs. **Issue 1**: Node.js SDK (node...
- Confusion around Tables / TablesDB vs Da...
Hello everyone, I ran into quite a bit of confusion when trying to migrate a Function from Databases.createDocument() to the new Tables / Rows API and wanted t...