Troubleshooting Guide

Common issues and solutions when working with cookies and the playground infrastructure.

Symptoms:

Possible Causes:

  1. Browser blocking cookies (privacy settings)
  2. Secure flag required but using HTTP
  3. Invalid cookie format
  4. Cookie size exceeds limit
  5. Domain format incorrect

Solutions:

  1. Check Browser Settings:

    • Verify cookies enabled
    • Check site-specific permissions
    • Disable blocking for testing site
  2. Check Secure Flag:

    • If on HTTPS, Secure flag may be required
    • Try without Secure flag first
    • Then add Secure flag if needed
  3. Verify Cookie Format:

    • Name and value valid characters
    • URL-encode special characters
    • Check for syntax errors
  4. Check Cookie Size:

    • Limit: ~4096 bytes total
    • Reduce cookie value size
    • Use session IDs instead of large data
  5. Domain Format:

    • Don't use leading dot (.example.com)
    • Use exact domain or parent domain
    • Verify domain matches current site

Symptoms:

Possible Causes:

  1. Domain attribute mismatch
  2. Path attribute mismatch
  3. Cookie expired
  4. SameSite policy blocking
  5. Browser privacy settings

Solutions:

  1. Check Domain Attribute:

    • Verify Domain matches request domain
    • Use parent domain for cross-subdomain access
    • Remove Domain attribute for exact domain only
  2. Check Path Attribute:

    • Verify Path matches request path
    • Use / for all paths
    • Check path case-sensitivity
  3. Check Expiration:

    • Verify cookie hasn't expired
    • Check Max-Age or Expires value
    • Set longer expiration for testing
  4. Check SameSite Policy:

    • SameSite=Strict blocks cross-site
    • Use SameSite=Lax for top-level navigation
    • Use SameSite=None; Secure for cross-site
  5. Check Browser Settings:

    • Verify cookies not blocked
    • Check privacy settings
    • Review site-specific permissions

Symptoms:

Possible Causes:

  1. Domain attribute too broad
  2. Missing Domain attribute (uses current domain)
  3. Path attribute too broad

Solutions:

  1. Specify Exact Domain:

    • Set Domain to exact subdomain
    • Or omit Domain attribute
    • Prevents parent domain access
  2. Use Restrictive Path:

    • Set Path to specific directory
    • Limits cookie scope
    • Prevents broader access
  3. Verify Domain Hierarchy:

    • Parent can't access subdomain cookies
    • Subdomains can access parent cookies
    • Test in playground to verify

Symptoms:

Possible Causes:

  1. Session cookie (no expiration)
  2. Max-Age too short
  3. Browser privacy settings
  4. Cookie cleared manually

Solutions:

  1. Set Expiration:

    • Add Max-Age attribute
    • Or use Expires attribute
    • Prevents session cookie expiration
  2. Check Browser Settings:

    • "Clear cookies on close" enabled?
    • Privacy settings clearing cookies?
    • Extensions clearing cookies?
  3. Verify Cookie Attributes:

    • Check Max-Age value
    • Verify Expires date
    • Ensure not negative

Issue 5: Multiple Cookies Not Working

Symptoms:

Possible Causes:

  1. Cookie name conflict
  2. Browser cookie limit reached
  3. Cookie size limit exceeded
  4. Domain/Path conflicts

Solutions:

  1. Unique Cookie Names:

    • Use different names for each cookie
    • Avoid overwriting existing cookies
    • Clear cookies between tests
  2. Check Cookie Limits:

    • Browser may limit cookies per domain
    • Delete unused cookies
    • Consolidate if needed
  3. Verify Cookie Size:

    • Total size within limits
    • Reduce individual cookie sizes
    • Use structured values if needed

Infrastructure Issues

Issue 6: Domain Not Resolving

Symptoms:

Possible Causes:

  1. DNS not propagated
  2. Route53 records incorrect
  3. Certificate not validated
  4. Terraform deployment incomplete

Solutions:

  1. Check DNS Propagation:

    • Wait 5-15 minutes after deployment
    • Use dig or nslookup to verify
    • Check Route53 console
  2. Verify Route53 Records:

    • Check A records exist
    • Verify alias targets correct
    • Check record names match domains
  3. Check Certificate Validation:

    • Verify ACM certificate validated
    • Check validation DNS records
    • Wait for validation completion
  4. Redeploy if Needed:

    • Run terraform plan to check state
    • Run terraform apply to fix issues
    • Check Terraform outputs

Issue 7: API Gateway Not Responding

Symptoms:

Possible Causes:

  1. Lambda function errors
  2. API Gateway configuration issues
  3. Deployment not completed
  4. Permissions issues

Solutions:

  1. Check Lambda Logs:

    • CloudWatch Logs for errors
    • Function execution results
    • Error messages and stack traces
  2. Verify API Gateway:

    • Check deployment status
    • Verify integrations correct
    • Check stage configuration
  3. Check Permissions:

    • Lambda execution role correct?
    • API Gateway can invoke Lambda?
    • CloudWatch logging permissions?
  4. Redeploy:

    • Update Lambda code if needed
    • Redeploy API Gateway
    • Verify changes applied

Issue 8: Pixel Endpoint Not Logging

Symptoms:

Possible Causes:

  1. CloudWatch permissions missing
  2. Log group doesn't exist
  3. Log stream issues
  4. Logging code errors

Solutions:

  1. Check IAM Permissions:

    • Lambda role has CloudWatch permissions?
    • Log group exists?
    • Permissions correct?
  2. Verify Log Groups:

    • Check CloudWatch console
    • Verify log groups created
    • Check retention settings
  3. Check Lambda Code:

    • Logging code present?
    • Error handling correct?
    • AWS SDK configured?
  4. 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:

Possible Causes:

  1. Privacy settings differ
  2. Enhanced Tracking Protection (Firefox)
  3. ITP (Safari) blocking
  4. Default SameSite behavior

Solutions:

  1. Check Privacy Settings:

    • Compare settings between browsers
    • Adjust to match for testing
    • Document differences
  2. Disable Tracking Protection (for testing):

    • Firefox: Disable ETP temporarily
    • Safari: Disable ITP temporarily
    • Chrome: Check privacy settings
  3. Verify SameSite:

    • Explicitly set SameSite attribute
    • Don't rely on defaults
    • Test with different values

Issue 10: Third-Party Cookies Blocked

Symptoms:

Possible Causes:

  1. Browser blocking third-party cookies
  2. SameSite policy too restrictive
  3. Missing Secure flag
  4. Privacy features enabled

Solutions:

  1. Use SameSite=None; Secure:

    • Required for cross-site cookies
    • Secure flag mandatory
    • HTTPS required
  2. Check Browser Settings:

    • Allow third-party cookies (testing only)
    • Check site-specific permissions
    • Review privacy settings
  3. Consider Alternatives:

    • First-party cookies
    • Server-side tracking
    • Privacy-preserving methods

Terraform Deployment Issues

Issue 11: Terraform Apply Fails

Symptoms:

Possible Causes:

  1. AWS credentials incorrect
  2. Insufficient permissions
  3. Resource conflicts
  4. State file issues

Solutions:

  1. Verify AWS Credentials:

    • aws sts get-caller-identity
    • Check AWS CLI configuration
    • Verify account access
  2. Check Permissions:

    • IAM user/role permissions
    • Resource creation permissions
    • Required service permissions
  3. Resolve Conflicts:

    • Check for existing resources
    • Use terraform import if needed
    • Clean up conflicts
  4. Fix State Issues:

    • Backup state file
    • Use terraform refresh
    • Re-import if needed

Issue 12: Certificate Validation Stuck

Symptoms:

Possible Causes:

  1. DNS records not created
  2. DNS not propagated
  3. Wrong validation records
  4. Route53 permissions

Solutions:

  1. Check DNS Records:

    • Verify validation records in Route53
    • Check record names and values
    • Wait for DNS propagation
  2. Manual Validation:

    • Check ACM console for required records
    • Verify records match
    • Re-request if needed
  3. Wait for Propagation:

    • DNS changes take 5-30 minutes
    • Check validation status
    • Be patient

Debugging Techniques

Technique 1: Browser Developer Tools

Steps:

  1. Open DevTools (F12)
  2. Network tab: View all requests
  3. Application tab: View stored cookies
  4. Console tab: Check for errors

What to Look For:

Technique 2: CloudWatch Logs

Steps:

  1. Open AWS CloudWatch console
  2. Go to Log Groups
  3. Find relevant log group
  4. View log streams
  5. Search for errors

What to Look For:

Technique 3: Terraform State Inspection

Steps:

  1. terraform state list - List all resources
  2. terraform state show <resource> - Show details
  3. terraform plan - Check for drift
  4. terraform refresh - Update state

What to Look For:

Technique 4: HTTP Inspector Analysis

Steps:

  1. Use playground HTTP inspector
  2. Clear inspector
  3. Perform action
  4. Review request/response details

What to Look For:

Prevention Strategies

  1. Always Specify Attributes: Don't rely on defaults
  2. Test in Multiple Browsers: Catch browser differences
  3. Check Browser Settings: Verify cookies enabled
  4. Use HTTPS: Secure flag requirements
  5. Monitor Logs: CloudWatch for errors
  6. Document Issues: Track problems and solutions
  7. Clean State: Start with fresh browser state for testing

Getting Help

Check Documentation

AWS Support

Browser Resources

Next Steps