Troubleshooting Guide
Common issues and solutions when working with cookies and the playground infrastructure.
Common Cookie Issues
Issue 1: Cookie Not Being Set
Symptoms:
- Cookie doesn't appear in cookie display
- Set-Cookie header not in HTTP inspector
- Cookie not stored in browser
Possible Causes:
- Browser blocking cookies (privacy settings)
- Secure flag required but using HTTP
- Invalid cookie format
- Cookie size exceeds limit
- Domain format incorrect
Solutions:
Check Browser Settings:
- Verify cookies enabled
- Check site-specific permissions
- Disable blocking for testing site
Check Secure Flag:
- If on HTTPS, Secure flag may be required
- Try without Secure flag first
- Then add Secure flag if needed
Verify Cookie Format:
- Name and value valid characters
- URL-encode special characters
- Check for syntax errors
Check Cookie Size:
- Limit: ~4096 bytes total
- Reduce cookie value size
- Use session IDs instead of large data
Domain Format:
- Don't use leading dot (
.example.com) - Use exact domain or parent domain
- Verify domain matches current site
- Don't use leading dot (
Issue 2: Cookie Not Being Sent with Requests
Symptoms:
- Cookie set successfully
- Cookie header missing in requests
- Cookie not accessible on other pages
Possible Causes:
- Domain attribute mismatch
- Path attribute mismatch
- Cookie expired
- SameSite policy blocking
- Browser privacy settings
Solutions:
Check Domain Attribute:
- Verify Domain matches request domain
- Use parent domain for cross-subdomain access
- Remove Domain attribute for exact domain only
Check Path Attribute:
- Verify Path matches request path
- Use
/for all paths - Check path case-sensitivity
Check Expiration:
- Verify cookie hasn't expired
- Check Max-Age or Expires value
- Set longer expiration for testing
Check SameSite Policy:
- SameSite=Strict blocks cross-site
- Use SameSite=Lax for top-level navigation
- Use SameSite=None; Secure for cross-site
Check Browser Settings:
- Verify cookies not blocked
- Check privacy settings
- Review site-specific permissions
Issue 3: Cookie Accessible When It Shouldn't Be
Symptoms:
- Cookie set for subdomain accessible by parent
- Cookie accessible on different domain
- Unexpected cookie sharing
Possible Causes:
- Domain attribute too broad
- Missing Domain attribute (uses current domain)
- Path attribute too broad
Solutions:
Specify Exact Domain:
- Set Domain to exact subdomain
- Or omit Domain attribute
- Prevents parent domain access
Use Restrictive Path:
- Set Path to specific directory
- Limits cookie scope
- Prevents broader access
Verify Domain Hierarchy:
- Parent can't access subdomain cookies
- Subdomains can access parent cookies
- Test in playground to verify
Issue 4: Cookie Disappears Unexpectedly
Symptoms:
- Cookie set successfully
- Cookie gone after navigation
- Cookie expires too quickly
Possible Causes:
- Session cookie (no expiration)
- Max-Age too short
- Browser privacy settings
- Cookie cleared manually
Solutions:
Set Expiration:
- Add Max-Age attribute
- Or use Expires attribute
- Prevents session cookie expiration
Check Browser Settings:
- "Clear cookies on close" enabled?
- Privacy settings clearing cookies?
- Extensions clearing cookies?
Verify Cookie Attributes:
- Check Max-Age value
- Verify Expires date
- Ensure not negative
Issue 5: Multiple Cookies Not Working
Symptoms:
- Can set one cookie
- Second cookie doesn't work
- Cookies conflict
Possible Causes:
- Cookie name conflict
- Browser cookie limit reached
- Cookie size limit exceeded
- Domain/Path conflicts
Solutions:
Unique Cookie Names:
- Use different names for each cookie
- Avoid overwriting existing cookies
- Clear cookies between tests
Check Cookie Limits:
- Browser may limit cookies per domain
- Delete unused cookies
- Consolidate if needed
Verify Cookie Size:
- Total size within limits
- Reduce individual cookie sizes
- Use structured values if needed
Infrastructure Issues
Issue 6: Domain Not Resolving
Symptoms:
- Cannot access playground domains
- DNS resolution errors
- Certificate errors
Possible Causes:
- DNS not propagated
- Route53 records incorrect
- Certificate not validated
- Terraform deployment incomplete
Solutions:
Check DNS Propagation:
- Wait 5-15 minutes after deployment
- Use
digornslookupto verify - Check Route53 console
Verify Route53 Records:
- Check A records exist
- Verify alias targets correct
- Check record names match domains
Check Certificate Validation:
- Verify ACM certificate validated
- Check validation DNS records
- Wait for validation completion
Redeploy if Needed:
- Run
terraform planto check state - Run
terraform applyto fix issues - Check Terraform outputs
- Run
Issue 7: API Gateway Not Responding
Symptoms:
- 502 Bad Gateway errors
- Timeout errors
- Lambda errors
Possible Causes:
- Lambda function errors
- API Gateway configuration issues
- Deployment not completed
- Permissions issues
Solutions:
Check Lambda Logs:
- CloudWatch Logs for errors
- Function execution results
- Error messages and stack traces
Verify API Gateway:
- Check deployment status
- Verify integrations correct
- Check stage configuration
Check Permissions:
- Lambda execution role correct?
- API Gateway can invoke Lambda?
- CloudWatch logging permissions?
Redeploy:
- Update Lambda code if needed
- Redeploy API Gateway
- Verify changes applied
Issue 8: Pixel Endpoint Not Logging
Symptoms:
- Pixel loads (1x1 GIF)
- No logs in CloudWatch
- Logs missing data
Possible Causes:
- CloudWatch permissions missing
- Log group doesn't exist
- Log stream issues
- Logging code errors
Solutions:
Check IAM Permissions:
- Lambda role has CloudWatch permissions?
- Log group exists?
- Permissions correct?
Verify Log Groups:
- Check CloudWatch console
- Verify log groups created
- Check retention settings
Check Lambda Code:
- Logging code present?
- Error handling correct?
- AWS SDK configured?
Test Logging:
- Trigger pixel endpoint
- Check CloudWatch after few seconds
- Verify log streams created
Browser-Specific Issues
Issue 9: Cookies Work in Chrome but Not Firefox
Symptoms:
- Cookies work in one browser
- Same cookies fail in another
- Behavior differs
Possible Causes:
- Privacy settings differ
- Enhanced Tracking Protection (Firefox)
- ITP (Safari) blocking
- Default SameSite behavior
Solutions:
Check Privacy Settings:
- Compare settings between browsers
- Adjust to match for testing
- Document differences
Disable Tracking Protection (for testing):
- Firefox: Disable ETP temporarily
- Safari: Disable ITP temporarily
- Chrome: Check privacy settings
Verify SameSite:
- Explicitly set SameSite attribute
- Don't rely on defaults
- Test with different values
Issue 10: Third-Party Cookies Blocked
Symptoms:
- Cookies not sent with cross-site requests
- Pixel requests missing cookies
- Cross-domain tracking fails
Possible Causes:
- Browser blocking third-party cookies
- SameSite policy too restrictive
- Missing Secure flag
- Privacy features enabled
Solutions:
Use SameSite=None; Secure:
- Required for cross-site cookies
- Secure flag mandatory
- HTTPS required
Check Browser Settings:
- Allow third-party cookies (testing only)
- Check site-specific permissions
- Review privacy settings
Consider Alternatives:
- First-party cookies
- Server-side tracking
- Privacy-preserving methods
Terraform Deployment Issues
Issue 11: Terraform Apply Fails
Symptoms:
terraform applyerrors- Resources not created
- State errors
Possible Causes:
- AWS credentials incorrect
- Insufficient permissions
- Resource conflicts
- State file issues
Solutions:
Verify AWS Credentials:
aws sts get-caller-identity- Check AWS CLI configuration
- Verify account access
Check Permissions:
- IAM user/role permissions
- Resource creation permissions
- Required service permissions
Resolve Conflicts:
- Check for existing resources
- Use
terraform importif needed - Clean up conflicts
Fix State Issues:
- Backup state file
- Use
terraform refresh - Re-import if needed
Issue 12: Certificate Validation Stuck
Symptoms:
- ACM certificate pending validation
- DNS validation not completing
- Deployment blocked
Possible Causes:
- DNS records not created
- DNS not propagated
- Wrong validation records
- Route53 permissions
Solutions:
Check DNS Records:
- Verify validation records in Route53
- Check record names and values
- Wait for DNS propagation
Manual Validation:
- Check ACM console for required records
- Verify records match
- Re-request if needed
Wait for Propagation:
- DNS changes take 5-30 minutes
- Check validation status
- Be patient
Debugging Techniques
Technique 1: Browser Developer Tools
Steps:
- Open DevTools (F12)
- Network tab: View all requests
- Application tab: View stored cookies
- Console tab: Check for errors
What to Look For:
- Cookie headers in requests
- Set-Cookie headers in responses
- JavaScript errors
- Network errors
Technique 2: CloudWatch Logs
Steps:
- Open AWS CloudWatch console
- Go to Log Groups
- Find relevant log group
- View log streams
- Search for errors
What to Look For:
- Lambda execution errors
- Pixel request logs
- Error messages
- Stack traces
Technique 3: Terraform State Inspection
Steps:
terraform state list- List all resourcesterraform state show <resource>- Show detailsterraform plan- Check for driftterraform refresh- Update state
What to Look For:
- Resource existence
- Current configuration
- State drift
- Missing resources
Technique 4: HTTP Inspector Analysis
Steps:
- Use playground HTTP inspector
- Clear inspector
- Perform action
- Review request/response details
What to Look For:
- Status codes
- Headers (Cookie, Set-Cookie)
- URLs
- Request methods
Prevention Strategies
- Always Specify Attributes: Don't rely on defaults
- Test in Multiple Browsers: Catch browser differences
- Check Browser Settings: Verify cookies enabled
- Use HTTPS: Secure flag requirements
- Monitor Logs: CloudWatch for errors
- Document Issues: Track problems and solutions
- Clean State: Start with fresh browser state for testing
Getting Help
Check Documentation
- Review relevant guide sections
- Check HTTP inspector output
- Compare with examples
AWS Support
- CloudWatch logs for Lambda errors
- API Gateway metrics
- Route53 DNS queries
Browser Resources
- Browser DevTools documentation
- Privacy settings guides
- Cookie specification (RFC 6265)
Related Topics
- Manual Testing Guide - Step-by-step testing
- HTTP Inspection - Understanding HTTP details
- Browser Behaviors - Browser-specific issues
- Using the Playground - Infrastructure usage
Next Steps
- Try solutions for your specific issue
- Document any new issues found
- Review Browser Behaviors for browser-specific help
- Check HTTP Inspection for debugging techniques