Skip to content
Back

[Solved] Create file is listing files instead of creating the file, this inside an Appwrite function

  • 0
  • Resolved
  • 2
  • Self Hosted
  • Functions
  • Storage
ponguta_
29 Jan, 2026, 19:32

This is a bit strange but, I cannot create files from within a funcion. I have tested with latest SDKs versions of node and python, both instead of creating the file, return the list of files that are stored on the bucket.

TypeScript
result = await storage.createFile({
    bucketId: OUTPUT_BUCKET_ID,
    fileId: outputFileId,
    file: InputFile.fromPath(tempPath, "certificate.pdf")
});
log(`createFile: ${JSON.stringify(result)}`);
TypeScript
createFile: {"total":3,"files":[{"$id":"69262f31001d4ecdf886","bucketId":"b_internal","$createdAt":"2025-11-25T22:35:29.899+00:00","$updatedAt":"2025-11-25T22:35:29.899+00:00","$permissions":["read(\"user:67086926000a44243115\")","update(\"user:67086926000a44243115\")","delete(\"user:67086926000a44243115\")"],"name":"university.png","signature":"561b1e77208ff23b5557b89ff8ee8ae5","mimeType":"image/png","sizeOriginal":27818,"chunksTotal":1,"chunksUploaded":1},{"$id":"69262f3500361d4be8dd","bucketId":"b_internal","$createdAt":"2025-11-25T22:35:34.283+00:00","$updatedAt":"2025-11-25T22:35:34.283+00:00","$permissions":["read(\"user:67086926000a44243115\")","update(\"user:67086926000a44243115\")","delete(\"user:67086926000a44243115\")"],"name":"signature.png","signature":"e36241b01aaa5cf646fc84cdee2c7307","mimeType":"image/png","sizeOriginal":10652,"chunksTotal":1,"chunksUploaded":1},{"$id":"6926310a0011858de642","bucketId":"b_internal","$createdAt":"2025-11-25T22:43:22.732+00:00","$updatedAt":"2025-11-25T22:43:22.732+00:00","$permissions":["read(\"user:67086926000a44243115\")","update(\"user:67086926000a44243115\")","delete(\"user:67086926000a44243115\")"],"name":"logo.png","signature":"64182af861a6f03318517c9de291613b","mimeType":"image/png","sizeOriginal":26408,"chunksTotal":1,"chunksUploaded":1}]}

Any help will be really appreciated.

TL;DR
Issue with Appwrite function not creating a file, but listing files. Solution: Set the endpoint to https in the Client configuration to fix the problem.
ponguta_
30 Jan, 2026, 20:00

Bump!

Axistro
30 Jan, 2026, 20:20

Probably downdrading a minor version will be better if this is actually a bug.

ponguta_
30 Jan, 2026, 20:34

Thanks for your answer, but its weird, I have tested on my local machine and it worked, but within the appwrite functions it just does like I said. Pretty weird.

4 Feb, 2026, 00:02

bump

4 Feb, 2026, 00:25

interesting if its only happening inside a function and works fine locally πŸ‘€

can you share your function code or a minimal example? <@679147141926617108>

5 Feb, 2026, 17:39

Seems like now is not only storage, I have created a new Table and look at this:

5 Feb, 2026, 17:40

The function:

TypeScript
import { Client, TablesDB, ID, Permission, Role } from 'node-appwrite';

export default async ({ req, res, log, error }) => {
    const client = new Client()
        .setEndpoint(process.env.APPWRITE_FUNCTION_API_ENDPOINT)
        .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
        .setKey(req.headers['x-appwrite-key'] ?? '');
    const tablesDB = new TablesDB(client);

    try {

        let res = await tablesDB.createRow({
            databaseId: 'db_master',
            tableId: 'wallet_transactions',
            rowId: ID.unique(),
            data: {
                "userId": '123123',
                "type": 'credit',
                "amount": '10',
                "description": `Hello!`,
                "translationId": null,
                "referralUserId": '123123'
            },
            permissions: [
                Permission.read(Role.label('admin')),
                Permission.update(Role.label('admin')),
                Permission.delete(Role.label('admin'))
            ]
        }
        );
        log("Response: ", res);
    } catch (err) {
        error("Err: " + err.message);
    }

    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",
    });
};

The log: Response: {"total":0,"rows":[]}

Im using "node-appwrite": "^20.2.1"

And runtime node-22

5 Feb, 2026, 17:48

I did ask to gemini and it gives me the answer:

Since I am behind nginx seems like sometimes the SDK gets bugged, so forcing the endpoint to use https fixes the issue:

TypeScript

    const client = new Client()
        .setEndpoint("https://<your_appwrite_ip_or_domain>/v1")
        .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID)
        .setKey(req.headers['x-appwrite-key'] ?? '');
1
5 Feb, 2026, 17:49

[Solved] Create file is listing files instead of creating the file, this inside an Appwrite function

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more