Skip to content

Patch: Fixes Github Issue 357: Ensure user object is consistently passed to DocumentStore service methods - #373

Merged
ct3685 merged 2 commits into
productionfrom
staging
Jul 8, 2025
Merged

Patch: Fixes Github Issue 357: Ensure user object is consistently passed to DocumentStore service methods#373
ct3685 merged 2 commits into
productionfrom
staging

Conversation

@ct3685

@ct3685 ct3685 commented Jul 8, 2025

Copy link
Copy Markdown

PR Title

Fix: Ensure user object is consistently passed to DocumentStore service methods

Description

🐛 Bug Fix

This PR addresses an inconsistency in how user-related metadata was passed to the DocumentStoreService methods upsertDocStoreMiddleware and refreshDocStoreMiddleware. Previously, only userId and organizationId were passed individually, while other parts of the system expect the full user object.

✅ Changes

  • Replaces individual userId and organizationId with the full user object (req.user) in both:
    • upsertDocStoreMiddleware controller method
    • refreshDocStoreMiddleware controller method
  • Ensures the service layer (documentstore/index.ts) properly consumes and forwards the user object when building internal payloads (e.g. docId and user pairing for loaders).

🧯 Why This Fix Matters

Some downstream logic (e.g., audit logging, scoped permissions, or async processing of loader entries) depends on the full user object being available. This fix ensures consistency and prevents unexpected undefined access errors during doc store operations.


🚀 Release Notes

Fixed a bug where only partial user data was sent to the document store service, potentially breaking downstream logic relying on the full user context. Now the full user object is consistently passed during both document upsert and refresh operations.

ct3685 and others added 2 commits July 8, 2025 15:37
- Fixed refreshDocStoreMiddleware controller to pass user object instead of userId/organizationId
- Fixed upsertDocStoreMiddleware controller to pass user object instead of userId/organizationId
- Fixed refreshDocStoreMiddleware service to include user object in totalItems array
- Resolves GitHub issue #357 - Cannot read properties of undefined (reading 'id') error
bugfix: document store refresh fails due to undefined user object
@vercel

vercel Bot commented Jul 8, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
answerai-docs ✅ Ready (Inspect) Visit Preview Jul 8, 2025 8:46pm
the-answerai 🔄 Building (Inspect) Visit Preview Jul 8, 2025 8:46pm

@ct3685 ct3685 added bug Something isn't working patch backend document-store labels Jul 8, 2025
@ct3685 ct3685 self-assigned this Jul 8, 2025
@ct3685 ct3685 changed the title release Patch: Fixes Github Issue 357: Ensure user object is consistently passed to DocumentStore service methods Jul 8, 2025
@ct3685
ct3685 merged commit 2e51111 into production Jul 8, 2025
6 of 7 checks passed
@maxtechera
maxtechera temporarily deployed to staging - theanswer-iek0 July 8, 2025 20:50 — with Render Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refresh button and /document-store/refresh/{id} endpoint not working for Document Stores

3 participants