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 using the openapi of chatflow or workflow, the interface with the url parameter of the remote_url being s3 will report an error #8389

Closed
5 tasks done
jiegod opened this issue Sep 13, 2024 · 3 comments
Labels
🐞 bug Something isn't working

Comments

@jiegod
Copy link

jiegod commented Sep 13, 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

0.8.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

"code": "invalid_param",
"message": "Run failed: [bedrock] Error: Failed to fetch image data from url https://tk-dev-datalake2.s3.ap-northeast-1.amazonaws.com/hex-integration?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEJD%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCICZsfLvlz0G2cDhVQAhYZZbT4Iob%2BtdJfZBiMtkbP2RQAiEAk%2BNn3HFus0hc6BL6WxljMbs1hzfX3oBumUgVTSNJ4E8q8wMIuf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARAFGgwxNzMwNjI1MDYzOTgiDFCSRJdYMgo2HuBIkyrHA6Rm3XoDoeMph%2BrW7ABCz6EVqvA%2F6hACmXJgXDhO9jv1wS9L09Yet3Zo5zOZflN51IE3wuO9ryD8%2FT7Qlwwi8k0PlfANuHwWKjkybb4sI0sP%2BHk8AWhENGNHBFEeJ%2BFBrEORSZU1bO19MhT9N%2F2lh2TRx%2FmLKwvu%2FNj95fLjwToQ1B49EIrctSne4tVYG1lw0e20TIl10OcHkuNxX%2Bl%2FsWMM5D%2BBd1RxJTjGBd1DRgU%2F1jPnA8pQKG0CMhcSsG1QiAigBhRTTFOqMOrt91Xr9PsRPa6PEw4osWz0T98TERF9Zc%2FV1cUkjPXdJ4z3%2BM7daL0DyYRcd7t8WcD%2Fg8tiHnfTQNyaYiWsrphwZwSPz9A2Ly7MJyVy7OgNHSDCrRm0a9ZL1oxjB%2FIiCdS3VVHbaZsnnXx2%2FW13TOlWHtCkdMKUE7jQeAFyE2wT%2FmDjWT0ncDKwtBWemVbPiiO4YLwEUmIpFv4GCABix0Z0faHnYWl7tzvMzFmmHpSiJ0Xq1N2Ste9LmTAclsoy%2Fw4jDUi5tkoh3lP8nombxXeyhRfYOqaKvmsrkARaJAFW3RW8bENrF2LsqWvXaAzmm92QVQRAv5btSg5MCQhDMPHfj7cGOpQBMETuhzIxcJ0fZ7Xq17O8MurCruFAlf4WBgarcQWf4ifh5vtYnfiAlFi4R3A3o16xGimp%2BejgODbGgp5AC1d44A8BdxTY7mMFaZqiWcH%2BkdguZL%2F6uUWq4QyI0kxC3KroDftCFgs4miIsIYoiym0gemZH8oxDpRHwmjYdRDQD%2FO1XXB0u0rbmsjMwYVXjqqj%2Fm9RLBg%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20240913T075529Z&X-Amz-SignedHeaders=host&X-Amz-Expires=900&X-Amz-Credential=ASIASQS2UI6PIFEYYIB6%2F20240913%2Fap-northeast-1%2Fs3%2Faws4_request&X-Amz-Signature=59cc1fc057a1cd97b299632df449b585cec588b069d734dd19611ed3a59e7334, type object 'Image' has no attribute 'open'",
"status": 400

✔️ Expected Behavior

normal return

❌ Actual Behavior

"code": "invalid_param",
"message": "Run failed: [bedrock] Error: Failed to fetch image data from url https://tk-dev-datalake2.s3.ap-northeast-1.amazonaws.com/hex-integration?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEJD%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCICZsfLvlz0G2cDhVQAhYZZbT4Iob%2B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529Z&X-Amz-SignedHeaders=host&X-Amz-Expires=900&X-Amz-Credential=ASIASQS2UI6PIFEYYIB6%2F20240913%2Fap-northeast-1%2Fs3%2Faws4_request&X-Amz-Signature=59cc1fc057a1cd97b299632df449b585cec588b069d734dd19611ed3a59e7334, type object 'Image' has no attribute 'open'",
"status": 400
Copy link

dosubot bot commented Sep 13, 2024

The error you're encountering suggests that the Dify API is having trouble fetching and processing the image from the provided S3 URL. Here are a few things to check and configure:

  1. S3 Configuration: Ensure that your S3 settings are correctly configured in the environment variables. Here are the necessary configurations:
STORAGE_TYPE=s3
S3_ENDPOINT=https://your-bucket-name.storage.s3.clooudflare.com
S3_BUCKET_NAME=your-bucket-name
S3_ACCESS_KEY=your-access-key
S3_SECRET_KEY=your-secret-key
S3_REGION=your-region
S3_USE_AWS_MANAGED_IAM=false
  1. URL Validity: Verify that the S3 URL is valid and accessible. The URL should be publicly accessible or have the correct permissions set.

  2. Image Handling: The error message indicates an issue with the Image object. Ensure that the image URL points to a valid image file and that the image format is supported.

  3. Temporary File Handling: The Dify API downloads the image content and saves it to a temporary file. Ensure that the temporary file handling is correctly implemented. Here is a relevant code snippet:

if not os.path.isfile(self.file_path) and self._is_valid_url(self.file_path):
    r = requests.get(self.file_path)

    if r.status_code != 200:
        raise ValueError(f"Check the url of your file; returned status code {r.status_code}")

    self.web_path = self.file_path
    self.temp_file = tempfile.NamedTemporaryFile()  # noqa: SIM115
    self.temp_file.write(r.content)
    self.file_path = self.temp_file.name
  1. Error Codes: The Dify API returns specific error codes for issues with the remote_url parameter. Here are some common ones:
    • 400, invalid_param: Abnormal parameter input
    • 400, unsupported_file_type: Unsupported file type for remote_url
    • 400, file_too_large: File too large, supports files under 15MB

Ensure that the image file meets the size and type requirements.

By verifying these configurations and ensuring the URL is correct and accessible, you should be able to resolve the issue. If the problem persists, double-check the S3 settings and the image file's accessibility and format [1][2].

To continue talking to Dosu, mention @dosu.

@dosubot dosubot bot added the 🐞 bug Something isn't working label Sep 13, 2024
@jiegod
Copy link
Author

jiegod commented Sep 19, 2024

? any one can reply

@crazywoola
Copy link
Member

crazywoola commented Sep 22, 2024

Fix: #8190 (Update Model nam… (#8426)

Fixed in above PR.

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

No branches or pull requests

2 participants