-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Description
When SST encounters certain errors (particularly missing secrets or AWS permission issues), the actual error message is hidden and users instead see:
RangeError: Invalid string length
at markNodeModules (node:internal/util/inspect:1613:21)
at formatError (node:internal/util/inspect:1747:18)
...
at Object.defaultErrorMessage (.sst/platform/node_modules/@pulumi/cmd/run/error.ts:28:21)
This makes debugging very difficult because the actual error (e.g., "Secret EMAIL not set") is never shown.
Root Cause
This is actually a bug in Pulumi's error handling code. I've filed an issue there:
- Pulumi issue: [link]
The bug is in @pulumi/pulumi/cmd/run/error.ts where util.inspect(err, { colors: true }) is called without error handling. AWS SDK errors (commonly triggered by SST) contain large metadata objects that cause util.inspect to crash.
Reproduction Steps
-
Create a new SST project with an alert system that links to a secret:
// infra/secrets.ts export const myEmail = new sst.Secret("EMAIL"); // infra/alerts.ts alertQueue.subscribe({ link: [myEmail], // This will fail if EMAIL secret isn't set // ... });
-
Do NOT set the secret:
# Skip this step intentionally # sst secret set EMAIL your@email.com --stage dev
-
Run
sst devorsst deploy -
Instead of "Secret EMAIL not set", you get
RangeError: Invalid string length
Environment
- SST: 3.17.25
- Node.js: v24.11.1
- OS: macOS arm64
Workaround
Until Pulumi fixes this upstream, you can:
- Check
.sst/log/sst.logfor the actual error - Use this debug script to capture and parse Pulumi's event logs: [link to gist or script]
Suggested SST Improvement
While waiting for Pulumi to fix this, SST could:
- Document this known issue
- Add better pre-flight checks for common issues (missing secrets)
- Consider patching Pulumi's error handler as a post-install step