Back

I need help to upload file (Image) through Cloud Function. (Node js)

  • 0
  • Self Hosted
  • Functions
Sarowar Rashid
4 Nov, 2024, 12:12

I need help to upload file (Image) through Cloud Function. Now i receive an error message, ""error": "Cannot read properties of undefined (reading 'Symbol(Symbol.asyncIterator)')" with base64 technique.

my code is: // Decode the base64-encoded image const base64Data = profilePicture.replace(/^data:image/\w+;base64,/, ""); const buffer = Buffer.from(base64Data, 'base64');

// Save the decoded image as a file const filePath = path.join('/tmp', ${ID.unique()}.png); fs.writeFileSync(filePath, buffer); const fileStream = fs.createReadStream(filePath);

//Save file to storage const uploadedFile = await storage.createFile(teacherImageBucketId, ID.unique(), fileStream);

TL;DR
Developers need help uploading an image file to Cloud Function in Node.js. They are facing an error related to reading properties of undefined with the base64 technique. The issue seems to be with decoding the base64-encoded image and saving it as a file.
Sarowar Rashid
4 Nov, 2024, 12:18

I need help to upload file (Image) through Cloud Function. (Node js)

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more