Skip to main content
Effective debugging is essential for maintaining and developing Trezor Suite. This guide covers debugging techniques for web, desktop, and native applications.

Development Tools

Chrome DevTools

Built-in browser debugging tools

React DevTools

React component inspection

Redux DevTools

Redux state debugging

VS Code Debugger

IDE-integrated debugging

Web Application Debugging

Chrome DevTools

1

Start development server

yarn suite:dev
Access at http://localhost:8000
2

Open DevTools

  • Press F12 or Cmd+Option+I (Mac) / Ctrl+Shift+I (Windows/Linux)
  • Or right-click → “Inspect”
3

Use debugging features

  • Console: Log messages and errors
  • Sources: Set breakpoints in code
  • Network: Monitor API requests
  • Elements: Inspect DOM and styles

Source Maps

Source maps are enabled in development mode for easy debugging.
In DevTools Sources tab:
  1. Navigate to webpack:// folder
  2. Find your source file (e.g., packages/suite/src/...)
  3. Set breakpoints by clicking line numbers
  4. Refresh page or trigger action to hit breakpoint

Console Debugging

console.log('Variable value:', myVariable);
console.error('Error occurred:', error);
console.warn('Warning message');
console.table(arrayOfObjects); // Nice table format
Remove console.log statements before committing. Use a proper logging library for production.

Desktop Application Debugging

Electron Main Process

The main process runs Node.js code for the Electron app.
1

Enable debugging

Modify packages/suite-desktop/package.json:
"dev:run": "electron --inspect=5858 ."
2

Open Chrome inspector

  1. Open Chrome and navigate to chrome://inspect
  2. Click “Configure” in “Devices” tab
  3. Ensure “Discover network targets” is enabled
  4. Add localhost:5858
  5. Your Electron app should appear in the list
3

Start debugging

yarn suite:dev:desktop
Click “inspect” under your app in Chrome inspector

Electron Renderer Process

The renderer process runs the web UI:
In the Electron app window:
  • Cmd+Option+I (Mac) or Ctrl+Shift+I (Windows/Linux)
  • Same as Chrome DevTools

Production Build Debugging

Debug production builds with logging:
./Trezor-Suite-22.7.2.AppImage --log-level=debug
Logs are written to the console and log files in the app data directory.

React Debugging

React DevTools

Install the React DevTools extension:
  • Inspect component hierarchy
  • View component props and state
  • Find component in tree by selecting element
  • Navigate to component source

React Error Boundaries

Use error boundaries to catch and debug React errors gracefully.
import { Component, ErrorInfo, ReactNode } from 'react';

interface ErrorBoundaryProps {
    children: ReactNode;
}

interface ErrorBoundaryState {
    hasError: boolean;
    error?: Error;
}

class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
    constructor(props: ErrorBoundaryProps) {
        super(props);
        this.state = { hasError: false };
    }

    static getDerivedStateFromError(error: Error): ErrorBoundaryState {
        return { hasError: true, error };
    }

    componentDidCatch(error: Error, errorInfo: ErrorInfo) {
        console.error('Error boundary caught:', error, errorInfo);
        // Log to error reporting service
    }

    render() {
        if (this.state.hasError) {
            return <div>Something went wrong. {this.state.error?.message}</div>;
        }

        return this.props.children;
    }
}

Redux Debugging

Redux DevTools

Install Redux DevTools Extension:
1

View actions

  • See all dispatched actions in real-time
  • Inspect action type and payload
  • Jump to action in timeline
2

State inspection

  • View complete Redux state tree
  • See state changes after each action
  • Diff state between actions
3

Time travel

  • Replay actions
  • Skip actions to see alternative states
  • Undo/redo actions
4

Export/import state

  • Export state for bug reports
  • Import state to reproduce issues
  • Share state with team

Logging Redux Actions

import { Middleware } from '@reduxjs/toolkit';

const actionLogger: Middleware = store => next => action => {
    console.group(action.type);
    console.log('Action:', action);
    console.log('Previous State:', store.getState());
    
    const result = next(action);
    
    console.log('Next State:', store.getState());
    console.groupEnd();
    
    return result;
};

// Add to store configuration (development only)

Network Debugging

Chrome Network Tab

1

Monitor requests

  • View all network requests
  • See request/response headers
  • Inspect payload data
  • Check response status codes
2

Filter requests

  • Filter by type (XHR, Fetch, WS)
  • Search by URL or domain
  • Show only failed requests
3

Throttling

  • Simulate slow network
  • Test loading states
  • Debug timeout issues

Trezor Connect Debugging

Trezor Connect handles device communication.
import TrezorConnect from '@trezor/connect';

// Enable debug mode
TrezorConnect.init({
    manifest: { /* ... */ },
    debug: true, // Logs all communication
});

// Listen to events
TrezorConnect.on('DEVICE_EVENT', event => {
    console.log('Device event:', event);
});

TrezorConnect.on('UI_EVENT', event => {
    console.log('UI event:', event);
});

Performance Debugging

React Profiler

  1. Open React DevTools
  2. Switch to “Profiler” tab
  3. Click record button
  4. Perform actions in app
  5. Stop recording

Performance API

// Measure component render time
const MyComponent = () => {
    React.useEffect(() => {
        performance.mark('component-render-start');
        
        return () => {
            performance.mark('component-render-end');
            performance.measure(
                'component-render',
                'component-render-start',
                'component-render-end',
            );
            
            const measure = performance.getEntriesByName('component-render')[0];
            console.log('Render time:', measure.duration, 'ms');
        };
    });

    return <div>Content</div>;
};

Chrome Performance Tab

1

Record performance

  1. Open Chrome DevTools → Performance tab
  2. Click record button
  3. Perform slow action
  4. Stop recording
2

Analyze profile

  • Flame chart: See what’s taking time
  • Bottom-Up: Longest running functions
  • Call Tree: Function call hierarchy
  • Event Log: Timeline of events

VS Code Debugging

Launch Configuration

Create .vscode/launch.json:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Chrome Debug",
            "type": "chrome",
            "request": "launch",
            "url": "http://localhost:8000",
            "webRoot": "${workspaceFolder}/packages/suite",
            "sourceMapPathOverrides": {
                "webpack:///*": "${webRoot}/*"
            }
        },
        {
            "name": "Jest Debug",
            "type": "node",
            "request": "launch",
            "program": "${workspaceFolder}/node_modules/.bin/jest",
            "args": ["--runInBand", "--coverage=0"],
            "console": "integratedTerminal"
        }
    ]
}
1

Set breakpoints

Click to the left of line numbers in VS Code
2

Start debugging

Press F5 or use Debug panel
3

Use debug controls

  • Continue (F5)
  • Step over (F10)
  • Step into (F11)
  • Step out (Shift+F11)

Common Debugging Scenarios

  1. Check React DevTools component tree
  2. Verify component is in render path
  3. Check conditional rendering logic
  4. Inspect parent component props
  5. Look for errors in console
  1. Open Redux DevTools
  2. Check if action was dispatched
  3. Verify action payload is correct
  4. Inspect reducer logic
  5. Check if component is subscribed to state
  1. Use React Profiler to find slow components
  2. Check for unnecessary re-renders
  3. Verify memoization (useMemo, useCallback)
  4. Look for expensive computations
  5. Use Chrome Performance tab for details
  1. Open Network tab in DevTools
  2. Find the failing request
  3. Check request headers and payload
  4. Inspect response status and body
  5. Verify CORS settings if applicable
  6. Check Trezor Connect logs for device communication

Development on Windows

Windows development requires special setup. See the Environment Setup guide.

Common Windows Issues

Always use Git Bash, not CMD or PowerShell, for running commands.
  • Slow builds: Exclude trezor-suite folder from Windows Defender
  • Path issues: Use forward slashes in paths
  • Line endings: Configure Git to use LF: git config --global core.autocrlf input
  • Node version: Use Node.js >=25.4.0 (not the version in .nvmrc)

Debugging Best Practices

1

Reproduce consistently

Find reliable steps to reproduce the issue before debugging
2

Isolate the problem

Narrow down which component, function, or module has the issue
3

Check the obvious first

  • Console errors
  • Network failures
  • Missing data
  • Type errors
4

Use debugger effectively

  • Set breakpoints at suspected locations
  • Inspect variable values
  • Step through code execution
5

Document findings

Note what you learned for future reference or bug reports

Resources

Chrome DevTools

Official Chrome DevTools documentation

React DevTools

React debugging tools guide

Redux DevTools

Redux debugging extension

Electron Debugging

Electron debugging guide

Build docs developers (and LLMs) love