From 8bde881e2cafd62c4a9763620d62674e56b7efc1 Mon Sep 17 00:00:00 2001 From: Dev Khant Date: Wed, 5 Mar 2025 13:13:28 +0530 Subject: [PATCH] Add AWS lambda issue to FAQ (#2303) --- docs/faqs.mdx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/faqs.mdx b/docs/faqs.mdx index 82243489..6748c8d2 100644 --- a/docs/faqs.mdx +++ b/docs/faqs.mdx @@ -84,6 +84,29 @@ iconType: "solid" - Include specific examples or cases rather than general definitions + + When deploying Mem0 on AWS Lambda, you'll need to modify the storage directory configuration due to Lambda's file system restrictions. By default, Lambda only allows writing to the `/tmp` directory. + + To configure Mem0 for AWS Lambda, set the `MEM0_DIR` environment variable to point to a writable directory in `/tmp`: + + ```bash + MEM0_DIR=/tmp/.mem0 + ``` + + If you're not using environment variables, you'll need to modify the storage path in your code: + + ```python + # Change from + home_dir = os.path.expanduser("~") + mem0_dir = os.environ.get("MEM0_DIR") or os.path.join(home_dir, ".mem0") + + # To + mem0_dir = os.environ.get("MEM0_DIR", "/tmp/.mem0") + ``` + + Note that the `/tmp` directory in Lambda has a size limit of 512MB and its contents are not persistent between function invocations. + +