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
- All My Project is Gone
Hello everyone, please help. Why have all my projects suddenly disappeared? I received a warning via email about one of my projects being paused. When I clicked...
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- > AppwriteException: The requested servi...
When trying to read or write from my database I get the following error: > AppwriteException: The requested service is disabled. You can enable the service from...