From 684a260b6c196406db1d0645a289a5942fb60b80 Mon Sep 17 00:00:00 2001 From: lopeselio Date: Tue, 11 Nov 2025 13:13:31 +0530 Subject: [PATCH 1/2] docs: document supabase google oauth fix for issue #73 --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 734240c3..c662822d 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,20 @@ See [apps/client/README.md](./apps/client/README.md#deployment) for details. See [apps/server/README.md](./apps/server/README.md#deployment) for details. +## 🛠 Troubleshooting + +**Google OAuth “Unsupported provider: provider is not enabled”** as highlighted in https://github.com/darkresearch/mallory/issues/73 +- **Summary:** Supabase blocks Google sign-in until the provider is enabled in the dashboard. +- **Steps to reproduce:** run Mallory with valid Supabase env vars, click **Continue with Google**, Supabase returns the 400 error. +- **Observed behaviour:** Supabase responds with `{"code":400,"error_code":"validation_failed","msg":"Unsupported provider: provider is not enabled"}` and the user cannot sign in. +- **Root cause:** the Google OAuth provider is disabled by default in Supabase projects. +- **Fix:** + - In the Supabase dashboard open `Authentication → Providers → Google`, flip **Enable** on. + - In Google Cloud Console create OAuth credentials (type “Web application”) if you haven’t already. + - Add redirect URIs such as `https://.supabase.co/auth/v1/callback`. + - Copy the client ID and secret back into Supabase. + - Save the provider settings, reload Mallory, and try **Continue with Google** again. + ## 🏷️ Version Management Mallory uses synchronized semantic versioning across all packages. From 32d4d72af5fc7c873736e0611d8c829439c4e475 Mon Sep 17 00:00:00 2001 From: lopeselio Date: Tue, 18 Nov 2025 03:32:01 +0530 Subject: [PATCH 2/2] fix: improve OpenMemory setup script with auto-clone and validation - Automatically clone OpenMemory backend from CaviraOSS/OpenMemory if missing - Remove .git directory from cloned repo to avoid nested git repositories - Add validation checks for backend directory, package.json, and build script - Create .env file with placeholder values (no secrets exposed) - Install dependencies automatically if node_modules doesn't exist - Add comprehensive error handling with helpful messages - Update README with OpenMemory setup instructions and configuration guide Fixes #79 --- README.md | 51 ++++++++++++++++++++++ services/openmemory-setup.sh | 84 +++++++++++++++++++++++++++++++++--- 2 files changed, 128 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c1a03e2c..fd135015 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,57 @@ OPENMEMORY_URL=http://localhost:8080 OPENMEMORY_API_KEY=your-openmemory-key ``` +#### OpenMemory Setup (Optional) + +OpenMemory provides infinite context for AI conversations. The setup script handles everything automatically: + +**Run the setup script**: +```bash +chmod +x services/openmemory-setup.sh +./services/openmemory-setup.sh +``` + +The setup script will: +- **Automatically clone** the OpenMemory backend from [CaviraOSS/OpenMemory](https://github.com/CaviraOSS/OpenMemory) (if not already present) +- **Remove the `.git` directory** from the cloned repo to avoid nested git repositories +- **Create the `.env` file** with default configuration (Gemini embeddings, SQLite database) +- **Install dependencies** using `bun install` +- **Build the TypeScript backend** using `bun run build` + +**Configure OpenMemory**: + +After running the setup script, edit `services/openmemory/backend/.env` and fill in the required variables: + +```bash +# Required: Embedding Provider API Key +# For Gemini (free tier): +OM_GEMINI_API_KEY=your-gemini-api-key + +# Or for OpenAI: +# OM_EMBED_PROVIDER=openai +# OM_OPENAI_API_KEY=your-openai-api-key + +# API Key for OpenMemory (used by Mallory server to authenticate) +OM_API_KEY=your-secure-api-key-here +``` + +**Add to Server Environment**: + +Add these to your `apps/server/.env` file: + +```bash +# OpenMemory Configuration +OPENMEMORY_URL=http://localhost:8080 +OPENMEMORY_API_KEY=your-secure-api-key-here # Must match OM_API_KEY above +``` + +**Start OpenMemory**: +```bash +cd services/openmemory/backend && bun start +``` + +> **Note**: OpenMemory is optional. Mallory works without it, but you'll get better context retention in long conversations if you use it. The backend is cloned from the [CaviraOSS/OpenMemory](https://github.com/CaviraOSS/OpenMemory) repository and is not included in this repo (see `.gitignore`). + ### 3. Run Development Servers #### Option A: Run Both (Client + Server) diff --git a/services/openmemory-setup.sh b/services/openmemory-setup.sh index 3b9aea49..ba979f9c 100755 --- a/services/openmemory-setup.sh +++ b/services/openmemory-setup.sh @@ -3,15 +3,55 @@ echo "🚀 Setting up OpenMemory for Mallory..." +# Check if OpenMemory backend directory exists +if [ ! -d "services/openmemory/backend" ]; then + echo "❌ OpenMemory backend not found!" + echo "" + echo "The OpenMemory backend is not included in this repository." + echo "Cloning OpenMemory backend from CaviraOSS/OpenMemory..." + echo "" + + # Create directory if it doesn't exist + mkdir -p services/openmemory + + # Clone the repository + git clone https://github.com/CaviraOSS/OpenMemory.git services/openmemory/backend + + if [ $? -ne 0 ]; then + echo "❌ Failed to clone OpenMemory backend!" + echo "Please check your internet connection and try again." + exit 1 + fi + + # Remove .git directory to avoid nested git repository + echo "🧹 Removing .git directory from cloned repository..." + rm -rf services/openmemory/backend/.git + + echo "✅ OpenMemory backend cloned successfully!" + echo "" +fi + +# Check if package.json exists +if [ ! -f "services/openmemory/backend/package.json" ]; then + echo "❌ OpenMemory backend package.json not found!" + echo "" + echo "The backend directory exists but doesn't contain the source code." + echo "Please ensure you've cloned the complete OpenMemory backend repository." + echo "" + exit 1 +fi + # Create .env file if it doesn't exist if [ ! -f services/openmemory/backend/.env ]; then echo "📝 Creating OpenMemory .env file..." + mkdir -p services/openmemory/backend cat > services/openmemory/backend/.env << 'EOF' # OpenMemory Configuration for Mallory +# See README.md for instructions on filling in these variables # Embedding Provider - Using Gemini (free tier!) OM_EMBED_PROVIDER=gemini -OM_GEMINI_API_KEY=${GEMINI_API_KEY} +OM_GEMINI_API_KEY=your-gemini-api-key-here # Server Configuration OM_PORT=8080 @@ -26,27 +66,57 @@ OM_TIER=smart # Vector Dimensions (Gemini) OM_VEC_DIM=768 -# API Key -OM_API_KEY=${OPENMEMORY_API_KEY:-openmemory_dev_key} +# API Key (used by Mallory server to authenticate with OpenMemory) +# Generate a secure random string for production use +OM_API_KEY=your-secure-api-key-here EOF echo "✅ .env file created" else echo "✅ .env file already exists" fi +# Install dependencies if node_modules doesn't exist +if [ ! -d "services/openmemory/backend/node_modules" ]; then + echo "📦 Installing OpenMemory dependencies..." + cd services/openmemory/backend + bun install + cd ../../.. +fi + # Build OpenMemory echo "🔨 Building OpenMemory..." cd services/openmemory/backend + +# Check if build script exists in package.json +if ! grep -q '"build"' package.json; then + echo "❌ 'build' script not found in package.json!" + echo "" + echo "The OpenMemory backend package.json is missing the 'build' script." + echo "Please ensure you've cloned the correct version of the OpenMemory backend." + echo "" + exit 1 +fi + bun run build +if [ $? -ne 0 ]; then + echo "" + echo "❌ Build failed!" + echo "Please check the error messages above and ensure:" + echo " 1. All dependencies are installed (bun install)" + echo " 2. The OpenMemory backend is up to date" + echo " 3. Required environment variables are set" + exit 1 +fi + echo "" echo "✅ OpenMemory is ready!" echo "" echo "To start OpenMemory:" echo " cd services/openmemory/backend && bun start" echo "" -echo "Or add to your .env:" -echo " OPENMEMORY_URL=http://localhost:8080" -echo " OPENMEMORY_API_KEY=openmemory_dev_key" -echo " OPENAI_API_KEY=your_openai_key" +echo "📝 Next steps:" +echo " 1. Edit services/openmemory/backend/.env to configure your API keys" +echo " 2. See README.md for required environment variables" +echo " 3. Add OPENMEMORY_URL and OPENMEMORY_API_KEY to your server .env file"