WHAT YOU'LL LEARN
  • How to debug API application errors
  • How to debug Admin application errors
  • Tools and techniques for each application type

Overview
anchor

Webiny consists of Admin and API applications. Errors can occur in different places, and understanding where an error originates is the first step to fixing it efficiently.

Error Types
anchor

Errors occur in three main areas:

  • API application - Server-side Lambda function errors, GraphQL operations
  • Admin application - Client-side React errors in the browser
  • Infrastructure - Deployment errors from Pulumi

Debugging API Application
anchor

API errors occur in AWS Lambda functions. During local development with yarn webiny watch api, debugging is straightforward because code runs locally.

Console Logs
anchor

Console logs are quick and effective for debugging API extensions:

extensions/MyApiExtension.ts

With Local AWS Lambda Development (yarn webiny watch api), console logs appear directly in the terminal. You get instant feedback like any local Node.js application.

Webiny Logger
anchor

For production logging that persists to CloudWatch, use Webiny’s Logger:

extensions/MyApiExtension.ts

When to Use Each
anchor

  • console.log - Quick debugging during local development
  • Logger - Production logging that needs to persist to CloudWatch

Logger Methods
anchor

Debugging Admin Application
anchor

The Admin application is a React application running in the browser. Use standard browser debugging tools.

Browser DevTools
anchor

Essential tools for Admin debugging:

Console - View logs and errors

extensions/MyAdminExtension.tsx

Network Tab - Inspect GraphQL requests and responses

  • View request/response payloads
  • Check authentication headers
  • Monitor API call timing

React Developer Tools - Debug React component state and props

  • Install: Chromeexternal link
  • Select elements to see component hierarchy
  • Inspect props and state
  • View component re-renders

GraphQL Network Inspector - Inspect GraphQL operations

  • Install: Chromeexternal link
  • View query/mutation details
  • Inspect variables and responses
  • Debug GraphQL errors
Finding Components

Use React DevTools “Select Element” tool to click any UI element and immediately see which React component renders it. Invaluable when working with unfamiliar code.

Common Admin Issues
anchor

Component Not Rendering

  • Check browser console for errors
  • Verify component is registered in webiny.config.tsx
  • Check React DevTools for component presence

GraphQL Errors

  • Use GraphQL Network Inspector to view error details
  • Check Network tab for failed requests
  • Verify API authentication

Styling Issues

  • Use browser DevTools Elements panel
  • Inspect applied CSS
  • Check for conflicting styles

Debugging Deployment Errors
anchor

Deployment errors occur when running yarn webiny deploy. Pulumi prints errors in the terminal.

Common Deployment Issues
anchor

Permission Errors

  • Check AWS credentials
  • Verify IAM permissions for required services
  • Review CloudFormation stack events

Resource Limits

  • Check AWS service quotas
  • Verify Lambda memory/timeout settings
  • Review DynamoDB capacity

Configuration Errors

  • Validate webiny.config.tsx syntax
  • Check extension paths are correct
  • Verify environment-specific config

Reading Pulumi Errors
anchor

Pulumi errors show:

  • Which resource failed
  • The error message
  • Stack trace if applicable

Example error:

Fix the IAM role configuration and redeploy.

Debugging Workflow
anchor

API Debugging Workflow
anchor

  1. Run yarn webiny watch api
  2. Trigger the operation
  3. Check terminal for console logs
  4. Add more logs if needed
  5. Fix issue and test again

Admin Debugging Workflow
anchor

  1. Run yarn webiny watch admin
  2. Open browser DevTools
  3. Reproduce the issue
  4. Check console for errors
  5. Use React DevTools to inspect components
  6. Fix issue and test again

Production Debugging
anchor

API Errors

  • Check CloudWatch Logs
  • Use Logger for persistent logs
  • Review Lambda execution details

Admin Errors

  • Use error tracking service (Sentry, etc.)
  • Check browser console logs from users
  • Review Network tab for failed requests

Best Practices
anchor

Use Structured Logging
anchor

Log Errors Properly
anchor

Use Appropriate Log Levels
anchor

  • debug - Detailed information for debugging
  • info - General informational messages
  • warn - Warning messages
  • error - Error messages

Remove Debug Logs Before Production
anchor

Remove or disable excessive debug logging before deploying to production to avoid cluttering CloudWatch logs.

Tools Summary
anchor

ToolPurposeApplication
console.logQuick local debuggingAPI
LoggerProduction loggingAPI
Browser ConsoleView logs and errorsAdmin
Network TabInspect API callsAdmin
React DevToolsDebug componentsAdmin
GraphQL InspectorDebug GraphQLAdmin
TerminalDeployment errorsInfrastructure