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

self.client = aliyun_s3.Bucket( TypeError: Bucket.__init__() got an unexpected keyword argument 'region' #4361

Closed
4 tasks done
harryhan1989 opened this issue May 14, 2024 · 8 comments · Fixed by #4425
Closed
4 tasks done
Labels
🐞 bug Something isn't working

Comments

@harryhan1989
Copy link

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).
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.6.8

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

配置阿里云oss存储报错,之前0.6.6版本正常

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

Copy link

dosubot bot commented May 14, 2024

The error you're encountering with the TypeError for an unexpected keyword argument 'region' when initializing the Alibaba Cloud OSS bucket in Dify version 0.6.8 suggests that the aliyun_s3.Bucket constructor does not accept a region parameter with the version of the oss2 library you are using. This issue could be due to changes in the oss2 library version or Dify's integration with it between versions 0.6.6 and 0.6.8.

To address this issue, you should first verify whether the oss2 library version you're using supports the region parameter by checking its documentation. If it doesn't, you'll need to remove the region parameter from the aliyun_s3.Bucket constructor call:

self.client = aliyun_s3.Bucket(
    oss_auth,
    app_config.get('ALIYUN_OSS_ENDPOINT'),
    self.bucket_name,
    connect_timeout=30
    # Removed region parameter
)

If your application's functionality relies on specifying a region, consider updating to a version of the oss2 library that supports this parameter, if available and compatible with Dify 0.6.8.

Additionally, Dify version 0.6.8 introduced new configurations for Alibaba Cloud OSS bucket initialization, including the authentication version (ALIYUN_OSS_AUTH_VERSION) and possibly the region (ALIYUN_OSS_REGION) for Alibaba Cloud OSS. Ensure these configurations are correctly set in your application, especially if you're using authentication version 'v4', which requires specifying the region.

Reviewing Dify's release notes or documentation for version 0.6.8 might provide further insights into any additional changes regarding Alibaba Cloud OSS bucket initialization or oss2 library usage that could guide the necessary adjustments.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@dosubot dosubot bot added the 🐞 bug Something isn't working label May 14, 2024
@harryhan1989
Copy link
Author

为什么同样配置0.6.6版本就可以,我在0.6.8版本上无论怎么配置都不行,就是会报这个错误

@harryhan1989
Copy link
Author

image

Copy link

dosubot bot commented May 14, 2024

The issue you're facing with Dify version 0.6.8, where the same configuration works in version 0.6.6 but not in 0.6.8, is likely due to changes in how the aliyun_s3.Bucket is initialized, specifically regarding the region parameter. In version 0.6.8, if the oss2 library or Dify's integration with it has changed to no longer accept a region parameter in the Bucket constructor, this would explain the TypeError you're encountering.

To address this, you should verify the version of the oss2 library being used and consult its documentation or source code to confirm if the region parameter is supported in the version included with Dify 0.6.8. If the region parameter is indeed unsupported, you'll need to adjust your code to either remove the region parameter from the aliyun_s3.Bucket constructor or conditionally include it based on compatibility.

This situation suggests a compatibility issue between Dify versions and the oss2 library's expectations for bucket initialization. Without the exact error message and traceback, it's challenging to provide a precise solution, but reviewing the oss2 library's documentation for the version used by Dify 0.6.8 and checking for any noted changes in Dify's release notes regarding Alibaba Cloud OSS integration should be your next steps.

Details

Sources


About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@harryhan1989
Copy link
Author

因为我是docker部署,我想问一下,你们下一个版本0.6.9版,能否在程序中处理掉这块的逻辑问题

@harryhan1989
Copy link
Author

还有就是我把版本设置为v4后,又报错了AttributeError: module 'oss2' has no attribute 'AuthV4'. Did you mean: 'AuthV2'?

@harryhan1989
Copy link
Author

image
这块代码你们测一下看能否通过

@harryhan1989
Copy link
Author

image
应该是oss2版本不对,更新最新版应该可以

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

Successfully merging a pull request may close this issue.

1 participant