Skip to content

Session folder grows to 1.8GB+ causing severe lag. How to prune safely without session invalidation? #2686

Closed

Description

@assaf274

Hi everyone,

I am using @wppconnect/client in a production environment (Monolithic Node.js setup).
I've noticed that the userDataDir (Chrome session folder) grows extremely fast. Within 48 hours, it reaches 1.8GB, causing the bot to become very slow and unresponsive.

My Goal:
I need to reduce the folder size and cleanup the cache without invalidating the session (I must avoid asking the client to rescan the QR code).

Questions:

  1. Safe Deletion: Which specific subfolders inside userDataDir are safe to delete via a Cron Job?
    (e.g., Is it safe to delete Default/Cache, Default/Code Cache, Default/GPUCache, and Default/Service Worker/CacheStorage without killing the WA Session?)

  2. Configuration: Is there a WPPConnect configuration to disable auto-downloading of media (Images/Videos) to prevent the IndexedDB or File System from bloating?

  3. Best Practice: Does anyone have a script or strategy to maintain a lightweight session over long periods?

Environment:

  • OS: Ubuntu Linux
  • Library: @wppconnect/client
  • Browser: Chrome (Headless)

Any advice would be appreciated. Thanks!

Activity

  1. added
    question
    on Feb 1, 2026
  2. manfe commented on Apr 30, 2026

    @manfe
    Contributor

    I have this script, but I only recommend to do it when the connection is stopped.

    #!/bin/bash
    # needs adjustments here, I removed some personal lines
    
    if [ ! -d "$PROFILE_PATH" ]; then
        echo "Error: Folder not found: $PROFILE_PATH"
        exit 1
    fi
    
    echo "Disk usage BEFORE cleanup:"
    du -sh "$PROFILE_PATH"
    
    echo "Cleaning cache directories..."
    
    sudo rm -rf "$PROFILE_PATH/Default/Service Worker"
    sudo rm -rf "$PROFILE_PATH/Default/Cache"
    sudo rm -rf "$PROFILE_PATH/Default/Code Cache"
    
    echo "Disk usage AFTER cleanup:"
    du -sh "$PROFILE_PATH"
    
    echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triagequestion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions