-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Summary
puter-cli crashes with an uncaught exception when running some normal commands (apps, sites), making automation unreliable.
It often prints partial output first, then throws:
Error: Call initPuterModule() first
───
Environment
• puter-cli version: 2.0.0
• Node.js: v20.19.4
• OS: Linux (Docker container)
• Base image used: nodered/node-red:latest
• Invocation mode: non-interactive shell (sh -lc), also reproducible in direct shell
───
Reproduction
- Install CLI:
npm install -g puter-cli@2.0.0
- Run:
puter apps
- Also reproduces with:
puter sites
───
Actual behavior
puter apps prints initial text:
Listing of apps during period "all" (try also: today, yesterday, 7d, 30d, this_month, last_month):
Then throws:
file:///usr/local/lib/node_modules/puter-cli/src/modules/PuterModule.js:27
throw new Error("Call initPuterModule() first");
^
Error: Call initPuterModule() first
at getPuter (file:///usr/local/lib/node_modules/puter-cli/src/modules/PuterModule.js:27:11)
at listApps (file:///usr/local/lib/node_modules/puter-cli/src/commands/apps.js:27:19)
at Command. (file:///usr/local/lib/node_modules/puter-cli/bin/index.js:63:13)
at Command.listener [as _actionHandler] (/usr/local/lib/node_modules/puter-cli/node_modules/commander/lib/command.js:552:17)
at /usr/local/lib/node_modules/puter-cli/node_modules/commander/lib/command.js:1586:14
at Command._chainOrCall (/usr/local/lib/node_modules/puter-cli/node_modules/commander/lib/command.js:1470:12)
at Command._parseCommand (/usr/local/lib/node_modules/puter-cli/node_modules/commander/lib/command.js:1585:27)
...
Node.js v20.19.4
puter sites shows a similar stack trace (via commands/subdomains.js / commands/sites.js).
───
Expected behavior
• Command should exit cleanly (0) when successful, or
• Return a handled/user-friendly error (no uncaught exception) if initialization/auth is missing.
───
Impact
• Breaks CI/automation/Node-RED exec workflows
• Produces partial stdout + failure exit code (hard to handle reliably)
• Forces stderr suppression workarounds (2>/dev/null) to avoid noisy failures
───
Suspected root cause
Initialization ordering issue: getPuter() appears to be called before module init in some command handlers (apps, sites).
───
Additional notes
• puter app --help works normally in the same environment.
• This appears command-path specific, not global binary corruption.