Open ZPerling opened 2 days ago
Hey, @ZPerling! I'm here to assist with bug fixes, answer your questions, and help you become a contributor. Let's tackle this issue together!
There is a similar closed issue regarding the requests
module not functioning well in the sandbox environment due to missing character detection dependencies like chardet
or charset_normalizer
. To resolve this, you can add one of these dependencies to your pyproject.toml
file:
[tool.poetry.dependencies]
# existing dependencies
chardet = "~5.1.0" # Add this line to include chardet
# or
charset_normalizer = "~3.2.0" # Add this line to include charset_normalizer
Additionally, the SSL error might be related to certificate verification issues. Here are some steps you can take:
Install Root Certificates: Ensure your system has the necessary root certificates installed. On Ubuntu, you can run:
sudo apt-get update
sudo apt-get install ca-certificates
Check Python SSL Configuration: Ensure the SSL module is correctly configured. Updating Python or the certifi
package can help:
pip install --upgrade certifi
Docker Configuration: If running Dify in Docker, ensure the container has access to the host's CA certificates. You might need to mount the host's certificate directory into the container.
These steps should help address the SSL error you're encountering [1][2].
To continue talking to Dosu, mention @dosu.
It seems there is something wrong with you network configurations.
@crazywoola thanks for your response.
I've only added the 'default' network to the sandbox section in the Docker Compose file. Could this be related to the problem? Here's the relevant code:
sandbox:
image: langgenius/dify-sandbox:0.2.10
restart: always
environment:
API_KEY: ${SANDBOX_API_KEY:-dify-sandbox}
GIN_MODE: ${SANDBOX_GIN_MODE:-release}
WORKER_TIMEOUT: ${SANDBOX_WORKER_TIMEOUT:-15}
ENABLE_NETWORK: ${SANDBOX_ENABLE_NETWORK:-true}
HTTP_PROXY: ${SANDBOX_HTTP_PROXY:-http://ssrf_proxy:3128}
HTTPS_PROXY: ${SANDBOX_HTTPS_PROXY:-http://ssrf_proxy:3128}
SANDBOX_PORT: ${SANDBOX_PORT:-8194}
volumes:
- ./volumes/sandbox/dependencies:/dependencies
healthcheck:
test: ['CMD', 'curl', '-f', 'http://localhost:8194/health']
networks:
- ssrf_proxy_network
- default
Self Checks
Dify version
0.10.2
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
When importing the Python requests library in the Dify workflow code execution module, an SSL exception is thrown. I previously saw a similar issue that was reportedly resolved by upgrading sandbox to version 0.2.9. However, after upgrading, the problem persisted.
Today, I upgraded to the latest versions (Dify 0.10.2 and sandbox 0.2.10), but the issue still remains.
Below is a screenshot of the specific error:
dify-sandbox log:
✔️ Expected Behavior
Python requests library should work normally
❌ Actual Behavior
Python requests not work