Skip to content

Conversation

@Hebx
Copy link
Contributor

@Hebx Hebx commented Nov 13, 2025

Description

Fixes the OpenMemory setup script (services/openmemory-setup.sh) to properly install and configure the CaviraOSS OpenMemory backend. The script was failing because:

  1. Missing repository cloning - The script assumed the OpenMemory repository already existed
  2. esbuild version mismatch - Using bun caused compatibility issues with esbuild (expected 0.25.11, got 0.25.12)
  3. Missing dependency installation - The script tried to build without installing dependencies first
  4. Incorrect path references - Used absolute paths instead of relative paths

This PR fixes all these issues and updates related files to use npm consistently.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Release (version bump)

Release

Is this a release? No

Testing

  1. Clean setup test:

    # Remove existing OpenMemory directory
    rm -rf services/openmemory
    
    # Run setup script
    bash services/openmemory-setup.sh
    
    # Verify:
    # ✅ Repository cloned successfully
    # ✅ Dependencies installed with npm (no esbuild errors)
    # ✅ Build completed successfully
    # ✅ .env file created with correct configuration
  2. Existing setup test:

    # With existing openmemory directory
    bash services/openmemory-setup.sh
    
    # Verify:
    # ✅ Script detects existing repository
    # ✅ Skips cloning
    # ✅ Still installs dependencies if needed
    # ✅ Builds successfully
  3. Start OpenMemory:

    cd services/openmemory/backend && npm start
    
    # Verify:
    # ✅ Server starts on port 8080
    # ✅ No errors in console
  4. Server health check:

    # Start server
    cd apps/server && bun run dev
    
    # Verify:
    # ✅ OpenMemory connection check passes
    # ✅ Error messages reference npm start (not bun start)

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • If releasing, I have verified the version number is correct and follows semantic versioning

What's Changed

services/openmemory-setup.sh

  • ✅ Added repository cloning from https://github.com/CaviraOSS/OpenMemory.git
  • ✅ Switched from bun to npm for dependency installation and building
  • ✅ Added dependency installation step before building
  • ✅ Fixed path references to use relative paths (after cd "$(dirname "$0")")
  • ✅ Added directory creation for openmemory/backend/data
  • ✅ Added error handling with set -e and set -o pipefail
  • ✅ Improved .env configuration with better defaults

package.json

  • ✅ Updated openmemory script from bun start to npm start

apps/server/src/server.ts

  • ✅ Updated health check to use root endpoint (cavira.app OpenMemory doesn't have /health)
  • ✅ Added Authorization header to health check
  • ✅ Updated error messages to reference npm start instead of bun start
  • ✅ Added instruction to run setup script first

README.md

  • ✅ Added note to run bash services/openmemory-setup.sh first
  • ✅ Updated API key documentation (default is openmemory_dev_key)
  • ✅ Added note about optional GEMINI_API_KEY for free embeddings

Why npm instead of bun?

The OpenMemory backend has a dependency on esbuild that has version compatibility issues with bun. When using bun, the postinstall script fails with:

Error: Expected "0.25.11" but got "0.25.12"

Using npm resolves this issue as npm's dependency resolution handles the esbuild version correctly. The rest of the project continues to use bun, but OpenMemory backend specifically uses npm.

Files Changed

  • services/openmemory-setup.sh (main fix)
  • package.json (updated script)
  • apps/server/src/server.ts (updated health check and error messages)
  • README.md (updated documentation)

@vercel
Copy link

vercel bot commented Nov 13, 2025

@Hebx is attempting to deploy a commit to the dark Team on Vercel.

A member of the Team first needs to authorize it.

package.json Outdated
"client": "cd apps/client && bun run web",
"server": "cd apps/server && bun run dev",
"openmemory": "cd services/openmemory/backend && bun start",
"openmemory": "cd services/openmemory/backend && npm start",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Hebx is there a reason we're moving from bun to npm? would prefer to keep npm across the board

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be fixed in next commit, was a version mismatch of esbuild.

README.md Outdated
```

See [apps/client/__tests__/CHAT_STATE_TESTS.md](./apps/client/__tests__/CHAT_STATE_TESTS.md) for full testing documentation.
See [apps/client/**tests**/CHAT_STATE_TESTS.md](./apps/client/__tests__/CHAT_STATE_TESTS.md) for full testing documentation.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we moving to **tests** instead of __tests__ somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo.

Hebx added 5 commits November 22, 2025 03:04
- Add repository cloning from CaviraOSS/OpenMemory if missing
- Switch from bun to npm to fix esbuild version compatibility issues
- Add dependency installation step before building
- Fix path references to use relative paths
- Create data directory if missing
- Update package.json script to use npm start
- Update server health check for cavira.app OpenMemory endpoints
- Update README with setup instructions and npm usage

Fixes issue where setup script failed due to:
- Missing repository (assumed it existed)
- esbuild version mismatch with bun
- Missing dependency installation step
… .env file

The heredoc used << 'EOF' which prevented shell variable expansion,
causing literal syntax like OM_EMBED_PROVIDER= to be written instead
of actual values. Changed to << EOF to allow proper variable expansion.
Previously, HTTP 401 (authentication failure) and 404 (not found) were
treated as successful connections, which masked authentication failures
and incorrect endpoint configurations. Now only HTTP 200 indicates a
successful connection, with specific error messages for 401 and 404.
- Add esbuild 0.25.12 as direct devDependency in OpenMemory backend
- Update setup script to use bun instead of npm
- Fix README typo: **tests** → __tests__
- Update all references from npm to bun for consistency

This fixes the root cause of the esbuild version mismatch (bun was
resolving to 0.25.11 but postinstall script expected 0.25.12) by
pinning the version, allowing us to use bun consistently throughout
the project instead of switching to npm as a workaround.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants