Back
Can I use the appwrite SDKs storage methods on +page.server.ts function on Sveltekit ?
- 0
- Web
- Storage
Alex
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
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here 🙂 I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...