I am trying to run my flask app to lambda. It deploy successfully (using serverless framework) but when I'm testing I get this error :
OSError: [Errno 30] Read-only file system
Part of the code that trigger the error :
with open("tmp/some-file.zip", "wb") as binary_file:
binary_file.write(file_content)
Any suggestion ?
In the provided example, you're using relative path to tmp, unless you're working dir is /, it will try to open a file in an invalid (not available for write) path. When trying to write to a file in /tmp (which is writable for Lambdas), ensure you're providing proper, ideally absolute path.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With