Skip to content

S3 storage engine crashes with 'trans.commit is not a function' when transactions disabled #220

Description

@salmen-essridi

Bug Description

When using the S3 storage engine with transactions: false in the config overrides, xyOps crashes during startup with:

TypeError: trans.commit is not a function
    at /opt/xyops/lib/monitor.js:687:12

Root Cause

Two issues in node_modules/pixl-server-storage/transaction.js:

1. Wrong truthy check on this.transactions

In beginTransaction() (line ~532):

if (!this.transactions) return callback(null, this);

this.transactions is the runtime transactions map object {}, not the config boolean. An empty object is truthy, so this check never passes even when Storage.transactions is set to false in config.

2. Missing commit/abort on returned object

When the check does pass, beginTransaction() returns this (the main storage object), but callers like monitor.js and list.js call trans.commit() and trans.abort() — methods that only exist on the TransStorage clone, not on the main storage object.

Fix

// Before:
if (!this.transactions) return callback(null, this);

// After:
if (!this.config.get('transactions')) {
    if (!this.commit) {
        this.commit = function(cb) { if (cb) cb(); };
        this.abort = function(cb) { if (cb) cb(); };
    }
    return callback(null, this);
}

Same fix needed for the other two occurrences:

// commitTransaction and abortTransaction:
if (!this.config.get('transactions')) return callback();

Environment

  • xyOps v1.0.39
  • Node.js v22.22.1
  • S3-compatible storage: Cloudflare R2
  • Config: Storage.engine: "S3", Storage.transactions: false

Reproduction

  1. Configure xyOps with S3 storage engine and transactions: false
  2. Start xyOps
  3. Crash on startup: TypeError: trans.commit is not a function

Reported by Salmen Essridi (@salmen-essridi)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions