[Python] Running browser-use in AWS EC2 says it cannot connect to network

Discussão em 'Python' iniciado por Stack, Maio 29, 2025.

  1. Stack

    Stack Membro Participativo

    I'm encountering the following error when using the browser-use feature in my Python application:

    Failed to connect to LLM. Please check your API key and network connection.


    Key details:

    • This issue only occurs when I run the application on an EC2 instance.
    • When I run the same code on my local machine, it works perfectly.
    • The API key is set correctly in both environments.
    • The EC2 instance has internet access, and other outbound requests (e.g., using requests.get) work fine.
    • I've verified the environment variables and confirmed the correct Python version and dependencies.
    • Connection on EC2 also looks fine to me as I can install deps, download repos and calling external APIs without an issue.

    Has anyone experienced this issue before? What could be causing the EC2 environment to fail connecting to the LLM, while the local environment works?

    Any help or troubleshooting tips would be appreciated.

    Continue reading...

Compartilhe esta Página