Problem
I’m trying to create a file in Appwrite Storage using the node-appwrite SDK.
The InputFile is generated from a base64 buffer, and I’m passing a fileId with ID.unique().
Code snippet:
TypeScript
const fileBuffer = Buffer.from(base64, 'base64');
const filenameForUpload = filename ?? `${ID.unique()}.bin`;
let newFileInBucket = await storage.createFile(
storageId,
ID.unique(),
InputFile.fromBuffer(fileBuffer, filenameForUpload),
[Permission.read(Role.team(teamId)), Permission.write(Role.team(teamId))]
);
Error:
TypeScript
AppwriteException: Param "fileId" is not optional
at _Client.call (.../node_modules/node-appwrite/dist/client.mjs:294:13)
...
Notes
ID.unique()returns a valid value (already logged).- The error still occurs even when logging the
fileId.
Environment
- Node.js v22
TL;DR
Bug report for creating a file in Appwrite Storage using `node-appwrite` SDK. Error states "Param 'fileId' is not optional" even when correctly passing it. Developers suggest trying a different syntax for `createFile` method.may try
TypeScript
const result = await storage.createFile({
bucketId: '<BUCKET_ID>',
fileId: '<FILE_ID>',
file: InputFile.fromPath('/path/to/file', 'filename'),
permissions: ["read("any")"] // optional
});
Recommended threads
- redirect_uri errors on flutter client
Hi all, I'm using the flutter client for my app to do appwrite auth and use the JWTs to send to my backend. When I try to sign in with SSO, I get this: https:/...
- float
Hello everyone, So, I created a column of type **float** with the **min** and **required** options, I noticed that it wouldn't let me set a **2 decimal points ...
- Unauthorized Charge on My Card – I Don’t...
Hi, I need urgent help. I received a bank SMS about a charge from "APPWRITE PRO" (18.460 JOD on 10/12/2025 at 03:47), but I DO NOT have an Appwrite account and...