Skip to content

fix(ts): lazy-load SQLite3 to prevent import time crashes#3919

Closed
shubham-021 wants to merge 2 commits intomem0ai:mainfrom
shubham-021:fix/sqlite3-eagerload
Closed

fix(ts): lazy-load SQLite3 to prevent import time crashes#3919
shubham-021 wants to merge 2 commits intomem0ai:mainfrom
shubham-021:fix/sqlite3-eagerload

Conversation

@shubham-021
Copy link
Copy Markdown

@shubham-021 shubham-021 commented Jan 19, 2026

Description

Currently the sdk import sqlite3 at module load time, even when users doesn't configure it. This causes the package to fail in environment where sqlite3 native bindings cannot compile.

Future Work : Current used sqlite package doesn't compile under environments like Bun. While this PR fixes the issue for users who doesn't need sqlite in their configuration , we still need a way to make sure it works in every envs.

Fixes #3882

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (does not change functionality, e.g. code style improvements, linting)

How Has This Been Tested?

  • Added an example file /mem0-ts/src/oss/examples/lazy-load-sqlite.ts , running this file crashes the process without the fix when not using sqlite3.

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Please delete options that are not relevant.

  • Test Script (please provide)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jan 21, 2026

CLA assistant check
All committers have signed the CLA.

@utkarsh240799
Copy link
Copy Markdown
Contributor

Resolved the issue in #4270 . Closing the PR.

@shubham-021 shubham-021 deleted the fix/sqlite3-eagerload branch March 12, 2026 12:07
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.

Node.js SDK: Lazy-load sqlite3 to avoid requiring native bindings when not used

3 participants