Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When running Alibaba's OCR sdk in the workflow, an error message appears: "error: operation not permitted" #11873

Open
5 tasks done
xuemusi opened this issue Dec 20, 2024 · 4 comments
Labels
🐞 bug Something isn't working 🌊 feat:workflow Workflow related stuff.

Comments

@xuemusi
Copy link

xuemusi commented Dec 20, 2024

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

Version 0.14.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Add Alibaba and Huawei ocs sdk
    alibabacloud_ocr_api20210707==3.1.2
    huaweicloudsdkcore==3.1.127
    huaweicloudsdkocr==3.1.127
image image
  1. Run the following code
import json
from alibabacloud_ocr_api20210707.client import Client as ocr_api20210707Client
from alibabacloud_tea_openapi import models as open_api_models
from alibabacloud_ocr_api20210707 import models as ocr_api_20210707_models
from alibabacloud_tea_util import models as util_models
from alibabacloud_tea_util.client import Client as UtilClient

Prompt error: “error: operation not permitted”
image

  1. I run python ocr.py directly in the container and it works, but an error message appears in the workflow.
image

✔️ Expected Behavior

I hope to execute simple python code in the workflow, such as calling api and executing sdk.

❌ Actual Behavior

Unable to run sdk.

Copy link

dosubot bot commented Dec 20, 2024

Hey @xuemusi! 👋 I'm here to help you with any bugs, questions, or contributions you have for Dify. Let's squash those bugs together!

The error message "operation not permitted" when running the Alibaba OCR SDK within a Dify workflow is likely due to the security restrictions of the DifySandbox. This sandbox environment enforces strict security measures, including a whitelist policy for system calls and isolated file system access, which might be preventing certain operations required by the SDK [1][2].

To resolve this issue, you can try the following steps:

  1. Check Permissions: Ensure that the operations required by the Alibaba OCR SDK are allowed within the DifySandbox. You might need to adjust the configuration to permit specific actions if they are currently restricted.

  2. Network Configuration: Verify that the network settings within the sandbox allow the necessary API calls. Dify uses network isolation strategies, and you may need to configure the ssrf_proxy service or Egress policies to allow the SDK's network requests [2][3].

  3. Error Handling: Implement error handling in your workflow to capture and manage any exceptions that occur due to these restrictions. This can help in identifying specific operations that are not permitted and adjusting your code or configuration accordingly [4].

If these steps do not resolve the issue, you may need to review the specific system calls and network requests made by the SDK to ensure they align with the sandbox's security policies.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot dosubot bot added 🌊 feat:workflow Workflow related stuff. 🐞 bug Something isn't working labels Dec 20, 2024
@yihong0618
Copy link
Contributor

you can refer the FAQ from https://github.com/langgenius/dify-sandbox/blob/main/FAQ.md

@svcvit
Copy link
Contributor

svcvit commented Dec 20, 2024

You can try https://github.com/svcvit/dify-sandbox-py

@xuemusi
Copy link
Author

xuemusi commented Dec 25, 2024

https://github.com/svcvit/dify-sandbox-py
Can run 。thanks @svcvit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🌊 feat:workflow Workflow related stuff.
Projects
None yet
Development

No branches or pull requests

3 participants