Plugin failes to load on mobile. · Issue #50 · polyipseity/obsidian-modules · GitHub
Skip to content

Plugin failes to load on mobile. #50

Open

Description

@karmeye

Not sure exactly when this started.

Obsdianan: 1.13.7
Modules. 2.5.2

[Error] Plugin failure: modules
TypeError: undefined is not an object (evaluating 'sjt.default.debuglog')
(anonymous function)
(anonymous function)
(anonymous function)
(anonymous function)
(anonymous function)
(anonymous function)
(anonymous function)
(anonymous function)
anonymous
(anonymous function) — app.js:1:2861178
(anonymous function) — app.js:1:258730
a — app.js:1:257553
	(anonymous function) (app.js:1:2864826)
	(anonymous function) (app.js:1:258730)
	s (app.js:1:257600)
 /**
 * Process a response from the native layer.
 */
cap.fromNative = result => {
    returnResult(result); // <------------------
};
else if (typeof storedCall.resolve === 'function') {
  // promise
  if (result.success) {
      storedCall.resolve(result.data); // <------------------
  }
  else {
      storedCall.reject(result.error);
  }
  // no need to keep this stored callback
  // around for a one time resolve promise
  callbacks.delete(result.callbackId);
}

Activity

  1. stef-rausch commented on Aug 24, 2026

    @stef-rausch

    I can confirm having the same issue.

  2. karmeye commented on Sep 19, 2026

    @karmeye
    Author

    Temporary fix by AI (see below).

    Replace /.obsidian/plugins/modules/main.js with → main.js

    🤖:
    Found it. The package is Wes Van Vugt's WesVanVugt/promise-pool-executor. The uncompiled source is in WesVanVugt/promise-pool-executor (ts/). The three buggy lines:

    Original (uncompiled)

    ts/private/utils.ts

    import util from "util";
    
    export const debug = util.debuglog("promise-pool-executor");
    
    export const isNull = (val: unknown): val is null | undefined =>
      val === undefined || val === null;

    ts/private/task.ts (line 6-ish)

    const debug = util.debuglog("promise-pool-executor:task");

    ts/public/pool.ts (line 23-ish)

    const debug = util.debuglog("promise-pool-executor:pool");
    debug("booting %o", "promise-pool-executor");

    Patch (uncompiled)

    Same transformation the plugin's build already applies to promise-batcher, applied here — each becomes:

    const debug = util?.[Symbol()] ?? (() => {});

    i.e. util.debuglog(...) (which crashes when util is undefined on mobile) → optional-chained unique-symbol access that always short-circuits to a no-op logger:

    // before
    const debug = util.debuglog("promise-pool-executor");
    // after
    const debug = util?.[Symbol()] ?? (() => {});
    
    // before
    const debug = util.debuglog("promise-pool-executor:task");
    // after
    const debug = util?.[Symbol()] ?? (() => {});
    
    // before
    const debug = util.debuglog("promise-pool-executor:pool");
    // after
    const debug = util?.[Symbol()] ?? (() => {});

    This is byte-for-byte what the existing main.js fix replaced — sjt.default.debuglog("promise-pool-executor") → sjt.default?.[Symbol()]??(()=>{}).

    The canonical repo-level fix lives in the plugin's scripts/build.mjs (uncompiled), widening the existing promise-batcher text-replace:

    esbuildPluginTextReplace({
      include: /(?:promise-batcher|promise-pool-executor).*\.js$/,
      pattern: [
        ['.debuglog("promise-batcher")', "?.[Symbol()]??(()=>{})"],
        ['.debuglog("promise-pool-executor")', "?.[Symbol()]??(()=>{})"],
        ['.debuglog("promise-pool-executor:task")', "?.[Symbol()]??(()=>{})"],
        ['.debuglog("promise-pool-executor:pool")', "?.[Symbol()]??(()=>{})"],
      ],
    }),

    Note: [Symbol()] approach disables debug logging on desktop too (harmless, matches the promise-batcher precedent); a gentler source fix would be util?.debuglog("promise-pool-executor") ?? (() => {}) to keep logging where util exists.

    🤖
    Each .default.debuglog("...") call became ?.[Symbol()]??(()=>{}) — optional chaining short-circuits to undefined when util is missing (mobile), and ?? (()=>{}) supplies a no-op logger.

  3. MostafaBJN commented on Oct 18, 2026

    @MostafaBJN

    Hi, The solution @karmeye provided did work for me.
    I just wanted to directly change the main.js file i did replace these three lines like this:
    sjt.default.debuglog("promise-pool-executor") => typeof sjt!="undefined" && sjt.default!=null ? sjt.default.debuglog("promise-pool-executor") : (() => {})
    ujt.default.debuglog("promise-pool-executor:task") => typeof ujt!="undefined" && ujt.default!=null ? ujt.default.debuglog("promise-pool-executor:task") : (() => {})
    mjt.default.debuglog("promise-pool-executor:pool") => typeof mjt!="undefined" && mjt.default!=null ? mjt.default.debuglog("promise-pool-executor:pool") : (() => {})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions