Internal error:
TypeScript
Error: Not Found
at Client.call (/usr/code-start/node_modules/node-appwrite/lib/client.js:171:31)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Databases.createDocument (/usr/code-start/node_modules/node-appwrite/lib/services/databases.js:1055:16)
at async module.exports (/usr/code-start/src/index.js:24:21)
at async /usr/local/src/server.js:68:13
My function code:
TypeScript
const sdk = require('node-appwrite');
module.exports = async function (req, res) {
const client = new sdk.Client();
const endpoint = req.variables['APPWRITE_FUNCTION_ENDPOINT'];
const project_id = req.variables['APPWRITE_FUNCTION_PROJECT_ID'];
client.setEndpoint(endpoint).setProject(project_id);
const operations_collection_id = req.variables['APPWRITE_FUNCTION_OPERATIONS_COLLECTION_ID'];
const results_collection_id = req.variables['APPWRITE_FUNCTION_RESULTS_COLLECTION_ID'];
const database_id = req.variables['APPWRITE_FUNCTION_DATABASE_ID'];
const database = new sdk.Databases(client);
const { a: value_x, b: value_y } = JSON.parse(req.payload);
const result = await database.createDocument(database_id, results_collection_id, sdk.ID.unique(), {
value: value_x + value_y,
});
const operation = await database.createDocument(database_id, operations_collection_id, sdk.ID.unique(), {
value_x,
value_y,
result_id: sdk.ID.unique(),
});
res.json({
operationId: operation.$id,
resultId: result.$id,
success: true,
});
};
TL;DR
When trying to create a new document, an "Error: Not Found" message is received. The solution to this error is to include "/v1" for the endpoint. The issue has been resolved by following this solution.Make sure to include /v1 for your endpoint
It works, thanks
[SOLVED] Error when trying to create new document (Function)
Recommended threads
- TablesDB can't be used in Appwrite Funct...
I have written a function (DART) and it won't deploy. Here is what I get : 2026-03-14T17:09:41.459693680Z Compiling ... 2026-03-14T17:09:42.915619217Z ../build...
- Realtime for files() works almost well, ...
I have been trying to make use of realtime, today (14.03.26) I have pulled all the latest versions of docker images, and sdk available. Whats working: - Conn...
- Local appwrite run functions --user-id n...
Hi, I'm running into an issue when testing Appwrite functions locally with user impersonation. I'm using a self-hosted Appwrite instance and running functions ...