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
- Project Inactivity Clarification
I'm on appwrite free plan with my account (om.thakkar@ivcventure.com). Even though throughout the week we use the project atleast once to upload dynamic content...
- [ENHANCEMENT] Use the custom Next.js dep...
Deployment adapters on Next.js are now stable! This means that we don't have to stick to the limitations of sniffing out build outputs and manually moving or mo...
- NextJS builds sudden runtime_timeout
My builds suddenly stopped working. Activating old prebuilt snapshots work, but redeploying that same code produces builds that throw runtime_timeout FRA region