Back
Can I use the appwrite SDKs storage methods on +page.server.ts function on Sveltekit ?
- 0
- Web
- Storage

Trying to create and send a file to the storage files but receiving an error
TypeScript
import * as sdk from 'node-appwrite';
export const actions = {
default: async ( {request} ) => {
const formData = await request.formData();
const data = formData.get('dataModel');
const blob = new Blob([data], { type: file.type});
const promise = storage.createFile(
BUCKET_ID,
sdk.ID.unique(),
sdk.InputFile.fromBlob(blob, file.name)
);
}
}
Error:
TypeScript
TypeError: Cannot read properties of undefined (reading 'pipe')
TL;DR
Developers are encountering errors when attempting to use the appwrite SDKs storage methods inside a Sveltekit server-side function. The issue seems to stem from the 'request' object not including the necessary methods for file handling. To resolve this problem, developers can try passing along the file directly to the storage createFile method, rather than using formData.Recommended threads
- Can't create a function. The user interf...
I am trying to create a server-side function. I am on the free tier. **I already have three functions that work properly** that I created a few months ago. Now,...
- Data Diet Needed
I love the nested related data... but can we request limited data? I think my requests need to go on a diet. I return my courses, and the units all come with th...
- Appwrite Cloud Ui and Server Crashes rep...
I am having trouble with Appwrite cloud and server crashes and Ui crashed repeatedly. Raised a GitHub issue as well. https://github.com/appwrite/appwrite/issues...
