decentraland / decentraland/creator-hub
[QA] Preview/build errors don't show sanitized diagnostic — either no detail shown or full raw stack trace exposed
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 14
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 44
Description
### 🛠️ **Build version:**
Decentraland Creator Hub 0.45.0 (fix/bevy branch) — PR #1463
### 📔 **Issue Description:**
Per PR #1463's description, item "Preview error sanitization" (#1464) should make the preview-failed toast show only the esbuild diagnostic (e.g. `src/index.ts:9:2 — Unexpected "}"`) instead of raw stack traces, paths, and internal CLI text. Tested with two different build-breaking errors in the Bevy editor, and neither produced the expected sanitized single-line diagnostic:
- **Scenario A (unresolved import):** produces a generic toast with no file/line/diagnostic at all — reads like the #1448 runtime-error path rather than the sanitized preview-error path.
- **Scenario B (syntax error):** produces the complete opposite — a full raw dump including the Node.js stack trace, internal `esbuild/lib/main.js` paths, the local machine's home directory and username in the file path, and the raw JS error object (`errors: [...], warnings: []`) printed verbatim. This is the exact pre-fix behavior the PR states it replaced.
### 👣 **STR:**
**Scenario A — unresolved import:**
1. Open a scene with up-to-date dependencies
2. In `src/index.ts`, add an unresolved import:
```typescript
import foo from '--data-layer'
```
3. Save, switch to/open the scene in the Bevy editor
4. Observe the error shown
**Scenario B — syntax error:**
1. Open a scene with up-to-date dependencies
2. In `src/index.ts`, add an extra unmatched closing brace at the end of the file:
```typescript
import {} from '@dcl/sdk/math'
import { engine } from '@dcl/sdk/ecs'
import { setupUi } from './ui'
export function main() {
// uncomment the line below to initialize UI from ui.tsx
//setupUi()
// your scene code here
}
}
```
3. Save, switch to/open the scene in the Bevy editor
4. Observe the error shown
### ✔️ **Expected Result:**
Both scenarios should show a single sanitized diagnostic line (e.g. `src/index.ts:11:0 — Unexpected "}"` for Scenario B), with no internal paths, stack traces, or raw error objects, per the PR's stated behavior for #1464.
### ❌ **Actual Result with evidence:**
- Scenario A: generic toast — "The scene has a runtime error and can't run. Check your scene code for the error that stopped it." No diagnostic detail.
- Scenario B: "Loading failed" screen shows the full raw error, including:
```
Error: Build failed with 1 error:
src/index.ts:11:0: ERROR: Unexpected "}"
at failureErrorWithLog (/Users/virginiabalducci/Library/Application Support/creator-hub/Scenes/New Scene 12/node_modules/esbuild/lib/main.js:1649:15)
at ... [full stack trace continues, including local username/home directory path]
{
errors: [ { detail: undefined, id: '', location: [Object], notes: [], pluginName: '', text: 'Unexpected "}"' } ],
warnings: []
}
```
[Screenshots attached: Scenario A generic toast, Scenario B raw stack trace on Loading Failed screen]
### ➗ **Reproduction:**
🔁 Always
#### 🖥️ **Operative system and additional Notes:**
Mac [confirm M1 or Intel]. Found while validating PR #1463, item "Preview error sanitization" (#1464). Both scenarios contradict the PR's stated behavior for this fix — sanitization does not appear to be wired into either the import-resolution or syntax-error paths tested. Scenario B additionally exposes local file system paths (home directory, username) which is a minor info-leak concern beyond just the UX regression.
Contributor guide
Assessment
This issue has not been assessed yet.