{"record":{"id":"5ac47ca60b1578ab","repo":"mem0ai/mem0","slug":"the-aws-sdk-client-neptune-graph-package-is-req","errorCode":null,"errorMessage":"The '@aws-sdk/client-neptune-graph' package is required to use the Neptune Analytics vector store. Install it with: npm install @aws-sdk/client-neptune-graph (original error: ${detail})","messagePattern":"The '@aws-sdk/client-neptune-graph' package is required to use the Neptune Analytics vector store\\. Install it with: npm install @aws-sdk/client-neptune-graph \\(original error: (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"mem0-ts/src/oss/src/vector_stores/neptune_analytics.ts","lineNumber":1051,"sourceCode":"  }\n\n  /**\n   * Load the optional AWS SDK on first use.\n   *\n   * This MUST be a dynamic `import()`, never `require()`: tsup/esbuild rewrite\n   * `require()` in the published ESM bundle (`dist/oss/index.mjs`) into a\n   * `__require` shim that throws `Dynamic require of \"...\" is not supported`,\n   * so every ESM consumer would hit a dead provider even with the SDK installed.\n   */\n  private async getSDK(): Promise<NeptuneSDK> {\n    if (!this.sdkPromise) {\n      this.sdkPromise = import(\"@aws-sdk/client-neptune-graph\").then(\n        (sdk) => sdk as unknown as NeptuneSDK,\n        (err) => {\n          // Let a later call retry rather than caching the rejection forever.\n          this.sdkPromise = undefined;\n          const detail = err instanceof Error ? err.message : String(err);\n          throw new Error(\n            \"The '@aws-sdk/client-neptune-graph' package is required to use the Neptune Analytics vector store. \" +\n              `Install it with: npm install @aws-sdk/client-neptune-graph (original error: ${detail})`,\n          );\n        },\n      );\n    }\n    return this.sdkPromise;\n  }\n\n  /** Memoized Neptune client; an injected `config.client` short-circuits the SDK. */\n  private async getClient(): Promise<NeptuneGraphClientLike> {\n    if (this.clientOverride) return this.clientOverride;\n    if (!this.clientPromise) {\n      this.clientPromise = this.getSDK()\n        .then(\n          ({ NeptuneGraphClient }) => new NeptuneGraphClient(this.clientConfig),\n        )\n        .catch((err) => {","sourceCodeStart":1033,"sourceCodeEnd":1069,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/vector_stores/neptune_analytics.ts#L1033-L1069","documentation":"The Neptune Analytics store lazy-imports @aws-sdk/client-neptune-graph on first use so the SDK stays an optional peer dependency. If the dynamic import fails (package not installed, or bundler could not resolve it), the store wraps the failure with install instructions and the original error, and clears the memoized promise so a later call can retry after the user installs the package.","triggerScenarios":"Using the Neptune Analytics vector store without @aws-sdk/client-neptune-graph installed; bundling with esbuild/webpack in a setup that cannot resolve the optional dependency; monorepo hoisting issues where the package is present in a different workspace.","commonSituations":"Installing mem0ai with a package manager that skips optional peers; tree-shaking/bundling for serverless (Lambda) that drops the optional import; adding the Neptune store to an existing project and forgetting the AWS SDK dependency.","solutions":["Run: npm install @aws-sdk/client-neptune-graph (or pnpm add / yarn add).","If already installed, verify it resolves from the project running mem0 (check node_modules, workspace hoisting) and reinstall in the correct package.","For bundlers, mark @aws-sdk/client-neptune-graph as external so the runtime import succeeds."],"exampleFix":"# before\nnpm install mem0ai\n# NeptuneAnalytics store throws on first query\n\n# after\nnpm install mem0ai @aws-sdk/client-neptune-graph","handlingStrategy":"try-catch","validationCode":"try {\n  await import('@aws-sdk/client-neptune-graph');\n} catch {\n  throw new Error('Install @aws-sdk/client-neptune-graph before using the Neptune store');\n}","typeGuard":null,"tryCatchPattern":"try { await store.search(q); } catch (e) { if (e.message.includes(\"'@aws-sdk/client-neptune-graph' package is required\")) { await installOrAbort(); } throw e; }","preventionTips":["Add @aws-sdk/client-neptune-graph as an explicit dependency when using this store","Smoke-test the store at startup with a trivial query","Mark the SDK external in bundler configs"],"tags":["neptune-analytics","aws-sdk","dependency","installation"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}