Skip to content

File attachment sync fails with EncryptedBlockstore errors in v0.23.0 #1063

@jchris

Description

@jchris

Bug Report: Screenshot File Access Fails for Synced Data with EncryptedBlockstore Errors

Summary

File attachments (screenshots) work for local data but fail to load for synced data with EncryptedBlockstore errors and "car not ready" messages when using toCloud() attachment.

Environment

  • Fireproof Version: v0.23.0 (UPGRADE BRANCH)
  • Application: Vibes DIY catalog system
  • Browser: Chrome
  • Sync: Using toCloud() attachment for authenticated users

Symptoms

Working Case (Local Data)

  • Vibe ID: fmehjlyodri54k8rfr
  • Result: ✅ Screenshot size: 34731 bytes
  • Display: File attachment renders correctly in UI
  • Database: Local-only (userId = 'local', no toCloud attachment)

Failing Cases (Synced Data)

  • Vibe IDs: fmehj91sfrrqff8cg8, fmehj9hy1pwdy0ddrx
  • Error: Failed to get Screenshot size: Error: {"module":"EncryptedBlockstore"...}
  • Display: File attachments don't render (fail silently)
  • Database: Cloud-synced data (userId = 'zs4m1mTYGk5LvSRsw', with toCloud attachment)

Code Context

The error occurs when calling file() method on Fireproof file attachments:

// In React component - accessing synced file attachment
if (doc._files?.screenshot) {
  doc._files.screenshot.file().then((file: File) => {
    console.log(`Screenshot size: ${file.size}`);
  }).catch((error: Error) => {
    console.error(`Failed to get Screenshot size:`, error);
  });
}

Database Configuration

// Conditional toCloud() attachment based on userId  
const { database, useAllDocs } = useFireproof(dbName, 
  userId && userId !== 'local' ? { attach: toCloud() } : {}
);

Console Error Details

[ERROR] {module: EncryptedBlockstore, this: z2z4uNe, level: error, cid: baembeigd3itv3ao4ub2xrid25e5...}
[ERROR] {module: EncryptedBlockstore, this: z2z4uNe, level: error, cid: baembeic6lyzpazbufr6wutswdys...}
[ERROR] Failed to get Screenshot size for fmehj91sfrrqff8cg8: Error: {"module":"EncryptedBlockstore"...}
[ERROR] Failed to get Screenshot size for fmehj9hy1pwdy0ddrx: Error: {"module":"EncryptedBlockstore"...}

Multiple failing CIDs with prefixes: baembeigd3itv3ao4ub2xrid25e5, baembeic6lyzpazbufr6wutswdys, various bafkr CIDs.

Expected Behavior

File attachments should be accessible via file() method regardless of whether data is local or synced via toCloud().

Actual Behavior

  • ✅ Local file attachments work correctly
  • ❌ Synced file attachments throw EncryptedBlockstore errors
  • ❌ "car not ready" messages suggest CAR (Content Addressable aRchive) format issues
  • ❌ File attachment data becomes inaccessible after sync

Reproduction Steps

  1. Create document with file attachment locally (works fine)
  2. Enable cloud sync using toCloud() attachment
  3. Access file attachment via doc._files.attachmentName.file() (fails)
  4. Observe EncryptedBlockstore errors in console

Impact

  • File attachments become inaccessible after cloud sync
  • Breaks user experience for cloud-synced applications
  • Suggests broader file attachment synchronization issues

Questions

  1. Is there a known issue with file attachment sync in v0.23.0 upgrade branch?
  2. Are CAR format files properly handled during toCloud() sync?
  3. Should EncryptedBlockstore errors be expected for synced content?
  4. Is there a different API for accessing synced file attachments?
  5. Are there any workarounds for accessing synced file data?

Additional Context

This issue affects the Vibes DIY application where screenshots are stored as Fireproof file attachments. The problem only manifests when using cloud sync - local-only databases work perfectly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions