n8nen.nl logo n8nen.nl

N8N Troubleshooting: 15 Veelvoorkomende Fouten Oplossen + Preventie (2025)

2025-01-24 Sam van N8Nen.nl
N8N Troubleshooting: 15 Veelvoorkomende Fouten Oplossen + Preventie (2025)

🚨 Emergency Troubleshooting

Workflow crashed? API failing? Deze complete N8N troubleshooting gids helpt je snel problemen identificeren en oplossen. Van authentication errors tot webhook issues - alle veelvoorkomende fouten met praktische stap-voor-stap oplossingen voor 2025.

Inhoudsopgave

Debug Workflow: Eerste Stappen

Voordat je diep duikt in specifieke fouten, start altijd met deze systematische debug aanpak:

🔍 Debug Checklist

1. Execution Log Controleren

  • • Ga naar Executions tab in N8N
  • • Bekijk de laatste failed executions
  • • Check exact error message
  • • Noteer timestamp van failure

2. Node-by-Node Testing

  • • Test elke node individueel
  • • Gebruik "Execute Previous Nodes"
  • • Controleer data flow tussen nodes
  • • Isoleer problematische node

3. Data Inspect

  • • Gebruik "View" button op nodes
  • • Controleer input/output data structure
  • • Verify JSON format
  • • Check for empty/null values

4. Browser Console

  • • Open Developer Tools (F12)
  • • Check Console voor JS errors
  • • Monitor Network tab voor failed requests
  • • Look for CORS or SSL issues

1. Authentication Errors (401/403)

Authentication errors zijn de meest voorkomende N8N problemen. "Request failed with status code 401" verschijnt vaak bij workflows die gisteren nog perfect werkten.

❌ Veelvoorkomende Auth Errors

401 Unauthorized

Betekenis: Invalid of expired credentials

Symptomen:

  • • "Authentication failed" error
  • • "Invalid API key" message
  • • Workflow werkte gisteren wel

✅ Oplossingen:

  1. 1. Check of API key nog geldig is
  2. 2. Test API key in external tool (Postman)
  3. 3. Regenereer API key indien nodig
  4. 4. Verify correct endpoint URL
  5. 5. Check for hidden spaces in credentials

403 Forbidden

Betekenis: Valid credentials, insufficient permissions

✅ Oplossingen:

  1. 1. Check API permissions/scopes
  2. 2. Verify user has access to resource
  3. 3. Contact API provider voor permission upgrade
  4. 4. Check rate limiting status

OAuth2 Token Issues

✅ Oplossingen:

  1. 1. Reconnect OAuth2 credentials
  2. 2. Check refresh token validity
  3. 3. Verify redirect URI matches exactly
  4. 4. Clear browser cache for auth flow

🔧 Quick Auth Fix Protocol

// Snelle auth test workflow:
1. Create nieuwe HTTP Request node
2. GET request naar: https://api.service.com/user (of /me)
3. Add je credentials
4. Execute node
5. 200 = OK, 401/403 = credential probleem

2. Webhook Problemen

Webhook errors zijn frustrerend omdat ze vaak in productie optreden. HTTPS toegankelijkheid is de belangrijkste vereiste voor werkende webhooks.

🔗 Webhook Troubleshooting

Veelvoorkomende Problemen

  • • Webhook URL niet bereikbaar
  • • HTTP instead of HTTPS
  • • SSL certificate problemen
  • • Firewall blocking requests
  • • Incorrect webhook path

✅ Oplossingen

  • • Ensure HTTPS is properly configured
  • • Test webhook URL in browser
  • • Check WEBHOOK_URL environment variable
  • • Use ngrok voor local testing
  • • Verify SSL certificate validity

Self-Hosted Webhook Setup

# .env configuratie voor webhooks:
WEBHOOK_URL=https://jouwdomein.nl/webhook
N8N_HOST=jouwdomein.nl
N8N_PROTOCOL=https
N8N_PORT=443

# Test webhook accessibility:
curl -X POST https://jouwdomein.nl/webhook/test \
     -H "Content-Type: application/json" \
     -d '{"test": "data"}'

N8N Cloud Webhooks

N8N Cloud webhooks werken automatisch met HTTPS. Problemen zijn meestal:

  • • Incorrect webhook URL copying
  • • Service niet accepting cloud URLs
  • • Rate limiting door N8N Cloud

3. HTTP Request Fouten

HTTP Request node errors komen vaak van parameter problemen, rate limiting of server issues. Hier zijn alle oplossingen:

🌐 HTTP Request Errors

Error Code Betekenis Veelvoorkomende Oorzaken Snelle Fix
400 Bad Request Invalid request Wrong parameters, invalid JSON Check request body format
404 Not Found Resource missing Wrong URL, deleted resource Verify endpoint URL
422 Unprocessable Validation error Missing required fields Check API documentation
429 Too Many Rate limited Too many requests Add delay, use batching
500 Server Error API server issue Temporary outage Retry with delay
502/503/504 Gateway issues CDN/proxy problems Wait and retry

Geavanceerde HTTP Request Debugging

Stap-voor-stap debug proces:

  1. 1. Request Details Checken:
    • • Method (GET/POST/PUT/DELETE)
    • • Headers (Content-Type, Authorization)
    • • Body format (JSON/Form/Raw)
    • • URL parameters en query strings
  2. 2. Response Analysis:
    • • Status code interpretation
    • • Response headers inspection
    • • Error message parsing
    • • Rate limit headers check
  3. 3. External Testing:
    • • Test same request in Postman
    • • Use curl command line
    • • Check API documentation
    • • Verify API status page

4. Data Format Errors

Data format errors ontstaan wanneer N8N onverwachte data structuren ontvangt. N8N verwacht altijd een array van objecten in het formaat [{ json: {...} }].

📊 Data Format Issues

Incorrect Data Return Format

❌ Fout - Direct object return:

// Code node returnt direct object:
return {
  name: "John",
  email: "john@example.com"
};

✅ Correct - N8N format:

// Code node returnt N8N format:
return [
  {
    json: {
      name: "John",
      email: "john@example.com"
    }
  }
];

Empty or Null Data

Veelvoorkomende problemen:

  • • Undefined variables in expressions
  • • Empty API responses
  • • Failed data transformations

✅ Oplossing - Safe data handling:

// Veilige data access met fallbacks:
const safeValue = $json.field || "default_value";
const safeArray = Array.isArray($json.items) ? $json.items : [];
const safeObject = $json.data && typeof $json.data === 'object' ? $json.data : {};

Array vs Single Object Issues

Problem: API sometimes returns array, sometimes single object

✅ Universal solution:

// Normalize naar array formaat:
const data = $json.result;
const normalizedData = Array.isArray(data) ? data : [data];

return normalizedData.map(item => ({ json: item }));

5. Expression & Reference Errors

Expression errors ontstaan wanneer N8N data niet kan ophalen die in een expression wordt gerefereerd. Dit gebeurt vaak bij ontbrekende node executions.

🔧 Expression Troubleshooting

Veelvoorkomende Expression Errors

  • Cannot read property 'json' of undefined
  • ReferenceError: $json is not defined
  • Cannot access 'NodeName' before execution
  • Expression evaluation error

✅ Preventie Tips

  • • Execute nodes before testing expressions
  • • Use "Execute Previous Nodes" option
  • • Test expressions in Code node first
  • • Add error handling voor undefined values

Safe Expression Patterns

❌ Unsafe expression:

={{$json.user.profile.email}}

✅ Safe expression with fallback:

={{$json.user?.profile?.email || 'no-email@example.com'}}

❌ Risky node reference:

={{$node["HTTP Request"].json.result}}

✅ Safe node reference:

={{$node["HTTP Request"]?.json?.result || null}}

Debug Expression Values

Use Code node voor expression debugging:

// Debug alle beschikbare data:
console.log("Current item:", $json);
console.log("Previous node:", $node["Node Name"]);
console.log("All items:", $items);
console.log("Workflow data:", $workflow);

return $input.all(); // Pass data through unchanged

6. Database Connection Issues

Database connectie problemen kunnen zowel configuratie als network gerelateerd zijn. Hier zijn systematische oplossingen voor alle database types.

💾 Database Troubleshooting

Connection String Issues

MySQL/PostgreSQL Examples:

// Correct MySQL:
mysql://user:pass@host:3306/database

// Correct PostgreSQL:
postgresql://user:pass@host:5432/database

// Met SSL:
postgresql://user:pass@host:5432/database?ssl=true

Veelvoorkomende Problemen

  • • Wrong port number
  • • Firewall blocking connections
  • • SSL certificate issues
  • • Incorrect username/password
  • • Database name typos
  • • Connection pooling limits

Database Connection Test Protocol

  1. 1. Basic Connectivity Test:
    # Test database host reachability:
    telnet database-host 3306  # MySQL
    telnet database-host 5432  # PostgreSQL
  2. 2. Credentials Verification:
    • • Test login via database client (MySQL Workbench, pgAdmin)
    • • Verify user has necessary permissions
    • • Check if IP/host is whitelisted
  3. 3. N8N Specific Testing:
    • • Create simple SELECT query node
    • • Test with SELECT 1 or SELECT NOW()
    • • Check execution logs voor detailed errors

Database-Specific Solutions

MySQL Issues
  • ER_ACCESS_DENIED_ERROR: Check user permissions
  • ER_BAD_HOST_ERROR: Whitelist IP address
  • ER_TOO_MANY_CONNECTIONS: Increase max_connections
PostgreSQL Issues
  • FATAL: password authentication failed: Check credentials
  • FATAL: no pg_hba.conf entry: Configure pg_hba.conf
  • connection refused: Check PostgreSQL service status
MongoDB Issues
  • Authentication failed: Check MongoDB user auth
  • ENOTFOUND: Verify connection string format
  • SSL handshake failed: Configure SSL properly

7. Rate Limiting Problemen

Rate limiting is een van de meest voorkomende problemen bij API integraties. "429 Too Many Requests" errors kunnen workflows volledig stoppen.

🚦 Rate Limiting Solutions

Symptomen van Rate Limiting

  • 429 Too Many Requests error
  • Rate limit exceeded message
  • Quota exceeded warnings
  • • Workflows werken sporadisch
  • • Errors alleen bij bulk operations

✅ Preventie Strategieën

  • • Implement request delays
  • • Use batching techniques
  • • Monitor API usage quotas
  • • Implement exponential backoff
  • • Use caching waar mogelijk

Praktische Rate Limiting Solutions

1. Split in Batches Node

Voor processing van grote datasets:

Configuration:

  • • Batch Size: 10-50 items (depending on API limits)
  • • Add Wait node between batches
  • • Wait Duration: 1-5 seconds per batch
2. Retry on Fail Configuration

Voor handling van 429 errors:

// HTTP Request node settings:
Retry on Fail: true
Max Tries: 5
Wait Between Tries: 2000ms (2 seconds)
Wait Between Tries Type: "Exponential" // 2s, 4s, 8s, 16s
3. Custom Rate Limiting Logic

Advanced solution met Code node:

// Rate limiting met custom logic:
const REQUESTS_PER_MINUTE = 60;
const DELAY_MS = 60000 / REQUESTS_PER_MINUTE; // 1 second tussen requests

// Get current timestamp
const now = Date.now();
const lastRequest = $workflow.lastRequestTime || 0;
const timeSinceLastRequest = now - lastRequest;

if (timeSinceLastRequest < DELAY_MS) {
  const waitTime = DELAY_MS - timeSinceLastRequest;
  await new Promise(resolve => setTimeout(resolve, waitTime));
}

// Update last request time
$workflow.lastRequestTime = Date.now();

return $input.all();

API-Specific Rate Limits

API Service Rate Limit Recommended Delay
Google APIs 100 req/100sec 1 second
Twitter API 300 req/15min 3 seconds
Slack API 1 req/second 1 second
GitHub API 5000 req/hour 0.7 seconds

8. Memory & Performance Issues

Memory en performance problemen kunnen N8N workflows drastisch vertragen of crashen. Deze problemen worden vaak veroorzaakt door grote datasets of inefficiënte workflows.

⚡ Performance Troubleshooting

Memory Gerelateerde Errors

  • JavaScript heap out of memory
  • Maximum call stack size exceeded
  • Process killed (OOMKilled)
  • • Workflow hangs/never completes
  • • Browser crashes during execution

Performance Symptomen

  • • Execution time > 10 minutes
  • • High CPU usage (>80%)
  • • Large memory consumption
  • • Slow response times
  • • Timeouts bij large datasets

✅ Performance Optimalisatie Strategieën

1. Data Processing Optimalisatie

❌ Inefficiënt:

// Process 10,000 items at once
const results = [];
for (let item of allItems) {
  results.push(processItem(item));
}
return results;

✅ Geoptimaliseerd:

// Process in batches of 100
const BATCH_SIZE = 100;
const results = [];
for (let i = 0; i < allItems.length; i += BATCH_SIZE) {
  const batch = allItems.slice(i, i + BATCH_SIZE);
  results.push(...batch.map(processItem));
}
2. Memory Usage Reductie
  • Remove Unused Fields: Filter out data je niet nodig hebt
  • Stream Processing: Process data as it comes in
  • Pagination: Fetch data in smaller chunks
  • Cleanup Variables: Set large variables to null when done
// Clean memory na processing:
const result = processLargeDataset(data);
data = null; // Free memory
largeTempVariable = null;
return [{ json: result }];
3. Workflow Architecture Improvements

✅ Good Practices:

  • • Use Split in Batches node
  • • Implement sub-workflows
  • • Add strategic Wait nodes
  • • Use appropriate node types
  • • Limit concurrent executions

❌ Avoid:

  • • Processing 10,000+ items at once
  • • Nested loops in Code nodes
  • • Storing large files in memory
  • • Recursive functions without limits
  • • Multiple concurrent heavy operations

System Resource Monitoring

Monitoring Tools:

  • N8N Cloud: Built-in execution monitoring
  • Self-hosted: Use htop, Docker stats, or Prometheus
  • Browser: DevTools Performance tab
  • Logs: Check N8N logs voor memory warnings

Geavanceerde Debug Technieken

Voor complexe problemen heb je geavanceerde debugging strategieën nodig. Deze technieken helpen bij het identificeren van root causes.

🔍 Advanced Debugging

1. Systematic Error Isolation

Isoleer problemen door workflow systematisch af te breken:

  1. Binary Search Method:
    • • Disable second half of workflow
    • • Test first half - works? Problem is in second half
    • • Continue bisecting until you find problematic node
  2. Node-by-Node Testing:
    • • Create isolated test for each node
    • • Use known good test data
    • • Compare expected vs actual outputs

2. Logging & Monitoring Setup

Implement comprehensive logging voor better visibility:

// Advanced logging in Code node:
const logData = {
  timestamp: new Date().toISOString(),
  workflowId: $workflow.id,
  executionId: $execution.id,
  nodeType: 'Custom Processing',
  inputCount: $input.all().length,
  memoryUsage: process.memoryUsage(),
  data: $json
};

console.log('DEBUG:', JSON.stringify(logData, null, 2));

// Send to external monitoring if needed
// await fetch('https://logging-service.com/log', { ... });

3. Error Boundary Implementation

Create robust error handling workflows:

// Error boundary pattern:
try {
  // Main processing logic
  const result = await processData($json);
  return [{ json: { success: true, data: result } }];
} catch (error) {
  // Comprehensive error logging
  const errorInfo = {
    message: error.message,
    stack: error.stack,
    input: $json,
    timestamp: new Date().toISOString(),
    nodeInfo: {
      name: $node.name,
      type: $node.type
    }
  };
  
  // Log to external service
  await logError(errorInfo);
  
  // Return error in expected format
  return [{ json: { success: false, error: errorInfo } }];
}

4. Performance Profiling

Track execution times and resource usage:

// Performance profiling in Code node:
const startTime = Date.now();
const startMemory = process.memoryUsage();

// Your processing logic here
const result = await heavyProcessing($json);

const endTime = Date.now();
const endMemory = process.memoryUsage();

const performance = {
  executionTime: endTime - startTime,
  memoryDelta: {
    rss: endMemory.rss - startMemory.rss,
    heapUsed: endMemory.heapUsed - startMemory.heapUsed
  },
  timestamp: new Date().toISOString()
};

console.log('PERFORMANCE:', performance);

return [{ json: { result, performance } }];

Preventie & Best Practices

De beste troubleshooting is preventie. Deze best practices helpen je problemen voorkomen voordat ze optreden.

🛡️ Preventie Strategieën

Workflow Design Principles

  • • Start simple, add complexity gradually
  • • Test each node before adding the next
  • • Use descriptive node names
  • • Add comments/notes voor complex logic
  • • Implement error handling from the start
  • • Use consistent data formats

Monitoring & Alerting

  • • Set up workflow execution alerts
  • • Monitor API quota usage
  • • Track performance metrics
  • • Implement health check workflows
  • • Use external monitoring services
  • • Regular credential rotation

Production Readiness Checklist

✅ Before Going Live:

  • • Test with production-like data volume
  • • Verify all credentials are production-ready
  • • Test error handling scenarios
  • • Validate rate limiting compliance
  • • Check webhook HTTPS accessibility
  • • Test backup/recovery procedures

🔄 Ongoing Maintenance:

  • • Regular credential updates
  • • Monitor execution logs daily
  • • Update API integrations as needed
  • • Performance optimization reviews
  • • Security audit quarterly
  • • Backup workflow configurations

Emergency Response Plan

When Workflows Fail in Production:

  1. 1. Immediate Assessment (0-5 min):
    • • Check N8N execution logs
    • • Verify API service status pages
    • • Check for widespread outages
  2. 2. Quick Fix Attempts (5-15 min):
    • • Retry failed executions
    • • Check/refresh credentials
    • • Test simple API calls
  3. 3. Escalation (15+ min):
    • • Activate backup workflows if available
    • • Contact API support if needed
    • • Implement temporary workarounds
    • • Document incident voor post-mortem

🚀 Hulp Nodig met Troubleshooting?

Loop je vast met een complexe N8N fout? Ik help je graag met professionele troubleshooting en optimalisatie!

Quick Reference: Error Code Cheat Sheet

Authentication (4xx)

  • 401: Invalid credentials
  • 403: Insufficient permissions
  • 404: Endpoint not found
  • 422: Validation error
  • 429: Rate limited

Server Errors (5xx)

  • 500: Internal server error
  • 502: Bad gateway
  • 503: Service unavailable
  • 504: Gateway timeout
  • 507: Insufficient storage

N8N Specific

  • ENOTFOUND: DNS/network issue
  • ECONNREFUSED: Connection refused
  • ETIMEOUT: Request timeout
  • CERT_ERROR: SSL certificate
  • JSON_PARSE: Invalid JSON

Veelgestelde Vragen over N8N Troubleshooting

Waarom werkte mijn workflow gisteren wel en vandaag niet?

Dit is meestal een authentication probleem. API keys kunnen verlopen, OAuth tokens moeten gerefresht worden, of de API service heeft planned maintenance. Check eerst je credentials en API service status pages.

Hoe kan ik zien wat er precies misgaat in mijn workflow?

Ga naar de Executions tab in N8N en bekijk de failed executions. Klik op een failed execution om de details te zien. Test ook individuele nodes met "Execute Previous Nodes" om te zien waar het probleem zit.

Mijn webhook krijgt geen data binnen, wat kan ik doen?

Check of je webhook URL publiek toegankelijk is via HTTPS. Test dit door de URL in een browser te openen. Verify ook of de webhook path correct is ingesteld in je external service. Voor local testing gebruik ngrok.

Hoe voorkom ik rate limiting problemen?

Gebruik de Split in Batches node voor grote datasets, implementeer Wait nodes tussen API calls, en configureer "Retry on Fail" met exponential backoff. Check ook de API documentation voor specifieke rate limits.

Mijn workflow is heel langzaam, hoe kan ik dit verbeteren?

Optimaliseer door data processing in batches te doen, onnodige velden te filteren, en gebruik efficiënte nodes. Avoid nested loops in Code nodes en process niet meer dan 1000 items tegelijk zonder batching.

Conclusie

Troubleshooting N8N workflows kan complex zijn, maar met de juiste aanpak en tools kun je vrijwel elk probleem oplossen. De sleutel is systematisch te werk gaan: isoleer het probleem, check de basis (credentials, network), en implementeer robuuste error handling.

Remember: de meeste N8N problemen vallen in een paar categorieën - authentication, rate limiting, data format issues, of network connectivity. Met deze gids heb je nu alle tools om snel problemen te identificeren en op te lossen.

💡 Laatste Tip

Investeer tijd in goede monitoring en logging vanaf het begin. Een paar extra minuten setup kunnen je uren debugging besparen later. En vergeet niet: elke error is een leermoment dat je workflows robuuster maakt!

Wil je meer leren over N8N? Check deze gerelateerde guides:

Emergency Troubleshooting?

Workflow crashed in productie? Kritieke automatisering werkt niet? Ik help je snel weer online!

🚨 Emergency Support →
#n8n #troubleshooting #fouten #oplossen #debugging #errors