
Hi there, I am getting a weird error where my file creation is timing out. Maybe I have the wrong syntax, but I tried to follow the documentation.
TypeScript
// Download the image directly as a stream
const imageResponse = await axios.get(output, { responseType: "arraybuffer", timeout: 10000}); // Use arraybuffer for compatibility
// Convert the array buffer to a Buffer
const imageBuffer = Buffer.from(imageResponse.data);
// Upload the image to Appwrite storage directly
const createFile = await storage.createFile(
config.bucketId, // Replace with your Appwrite storage bucket ID
ID.unique(), // Generate a unique file ID
imageBuffer, // Pass the stream directly
["user:" + account_id] // Set user-specific permissions (read/write access)
);
// Save metadata in Appwrite database
const metadata = {
account_id: account_id, // The user's account ID
file_id: createFile.$id, // File ID in Appwrite
userPrompt: additionalUserPrompt, // Store the prompt for reference
};
// Create MetaData entry
const createReplicateMetadataDocument = await databases.createDocument(
config.databaseId,
config.replicateMetadataId, // Replace with your Appwrite database collection ID
ID.unique(), // Generate a unique document ID
metadata
);
TL;DR
Developers are facing a timeout issue while creating a file due to an error in the code. The error points to a problem with the 'Storage.createFile' function. The issue arises from passing the imageBuffer to the storage.createFile function. The code needs to be revised to resolve this error.
and here is the error from the function execution:
TypeScript
Error calling Replicate: TypeError: Cannot read properties of undefined (reading 'Symbol(Symbol.asyncIterator)')
at Storage.createFile (/usr/local/server/src/function/node_modules/node-appwrite/lib/services/storage.js:404:40)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Module.default (file:///usr/local/server/src/function/src/main.js:76:24)
at async execute (/usr/local/server/src/server.js:208:16)
at async action (/usr/local/server/src/server.js:225:7)
at async /usr/local/server/src/server.js:14:5
The error is happening around 14s so it isn't the 30s timeout causing it. Anybody have ideas? Thanks.
Recommended threads
- Having errors migrating to cloud
Project will not migrate compeltely
- Appwrite realtime stopped working all of...
In our production environment, Appwrite Realtime suddenly stopped working and no updates are coming through , can you confirm if there are any known issues?
- $40 Bill with one project
Hello, my bill is set to be $40 even though I only have 1 project in my account. Am I not supposed to be charged $25?
