Back

Module not found: Can't resolve 'fs' when trying to upload file to storage

  • 0
  • Cloud
Nikky
8 May, 2024, 14:52

I get this error while trying to upload file to appwrite storage using createFile. Im using node-sdk, nextjs and server actions. How can I upload file (File type) to appwrite storage using node-sdk?

TL;DR
Developers encounter a 'Module not found: Can't resolve 'fs'' error while uploading a file to Appwrite storage using the Node.js SDK, Next.js, and Server Actions. They seek guidance on correctly uploading a file to Appwrite storage using the Node.js SDK. **Solution:** This issue is caused by the 'fs' module not being available in client-side JavaScript environments like Next.js. To resolve this, the file upload logic should be handled server-side or within server actions instead of the client-side code.
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