Access Filesystem in custom function

Hey there,
I’m trying to build a custom documents/files upload handler with Digitalocean Spaces. What I try to aceive is a Mutation calles fileUpload that receives a filename and a base64 string. Before uploading, I’ll need to temporarily save the file with fs.writeFileSync(). Unfortunately, this gives me the error message "EROFS: read-only file system, open ./path/file.pdf".

Is there any workaround on this? What’s the go-to way to handle file-uploads to file storage services in custom functions?

Any help is greatly appreciated :slight_smile:

Hey @dominik!
Sent this to our developers. I’ll come back to you with feedback soon.

Try to use "/tmp" path in fs.writeFileSync() method.
Make sure you use it only for temporary files because we can’t guarantee safety and security for those during several requests (they will be stored only per request).
Also, note that there is a 500Mb limit for such files.