Home > Documentation > Troubleshooting
Troubleshooting Guide
Solutions to common issues and debugging strategies for ParleyJS.
Overview
This section helps you diagnose and fix common problems with ParleyJS. Start with Common Errors for quick solutions, or see the complete Troubleshooting Guide for comprehensive debugging strategies.
Contents
- Common Errors - Quick solutions to frequent errors
- Connection issues
- Origin validation errors
- Timeout errors
- Type errors
Complete Troubleshooting Guide
- TROUBLESHOOTING.md - Comprehensive troubleshooting
- Debugging strategies
- Common mistakes
- Performance issues
- Error reference
Quick Fixes
Connection Not Working
Problem: Unable to connect to iframe/window
Quick fixes:
- Wait for iframe load event
- Check both sides call
connect() - Verify origins match exactly
- Enable debug mode:
debug: true
See Connection Issues for details.
Messages Not Received
Problem: Handler not called when message sent
Quick fixes:
- Register handlers before sending messages
- Check message type strings match exactly
- Verify origins are configured correctly
- Check browser console for errors
See Message Not Received for details.
Origin Validation Errors
Problem: SecurityError - Origin mismatch
Quick fixes:
- Check protocol matches (http vs https)
- Remove port numbers if using defaults
- Check for subdomain mismatches
- Use environment variables for origins
See Origin Validation Errors for details.
Timeout Errors
Problem: TimeoutError - Request timed out
Quick fixes:
- Ensure handler calls
respond() - Catch errors in handler and respond
- Increase timeout value
- Verify handler is registered
See Timeout Errors for details.
Debugging Tools
Enable Debug Mode
const parley = Parley.create({
allowedOrigins: ['https://child.com'],
debug: true, // Logs all messages
});Monitor System Events
import { SYSTEM_EVENTS } from 'parley-js';
parley.onSystem(SYSTEM_EVENTS.ERROR, (event) => {
console.error('ParleyJS Error:', event);
});
parley.onSystem(SYSTEM_EVENTS.MESSAGE_SENT, (event) => {
console.log('Sent:', event.messageType);
});Inspect Raw Messages
window.addEventListener('message', (event) => {
console.log('Raw postMessage:', {
origin: event.origin,
data: event.data,
});
});Common Mistakes
- Not waiting for connection before sending
- Using wildcard origins in production
- Forgetting to call respond() in handlers
- Sending non-serializable data (functions, circular refs)
- Not cleaning up listeners and connections
See Common Mistakes for details.
Error Reference
For complete error documentation, see:
- Common Errors - Frequent error solutions with fixes
- TROUBLESHOOTING.md - Complete debugging guide
- Error Handling Pattern - Error handling strategies
Still Having Issues?
If you're still stuck:
- Check examples: See Examples for working code
- Review API docs: See API Reference
- Search issues: Check GitHub Issues
- Ask for help: Open a new issue with:
- ParleyJS version
- Browser and version
- Minimal reproduction code
- Error messages and debug logs
Related Sections
- Common Errors - Quick error solutions
- TROUBLESHOOTING.md - Complete guide
- Error Handling Pattern - Error patterns
- Examples - Working code
- Security - Security issues
Navigation
Topics:
Related:
Back to: Documentation Home | Project Home
