-
Notifications
You must be signed in to change notification settings - Fork 14
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
Align New with NewClient #252
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Orca Security Scan Summary
Status | Check | Issues by priority | |
---|---|---|---|
![]() |
Infrastructure as Code | ![]() ![]() ![]() ![]() |
View in Orca |
![]() |
SAST | ![]() ![]() ![]() ![]() |
View in Orca |
![]() |
Secrets | ![]() ![]() ![]() ![]() |
View in Orca |
![]() |
Vulnerabilities | ![]() ![]() ![]() ![]() |
View in Orca |
🛡️ The following IaC misconfigurations have been detected
NAME | FILE | ||
---|---|---|---|
![]() |
Container Traffic Not Bound To Host Interface | ...recated-api-test.yml | View in code |
![]() |
Container Traffic Not Bound To Host Interface | ...recated-api-test.yml | View in code |
![]() |
Container Traffic Not Bound To Host Interface | ...er-compose-azure.yml | View in code |
![]() |
Container Traffic Not Bound To Host Interface | ...-compose-cluster.yml | View in code |
![]() |
Container Traffic Not Bound To Host Interface | ...-compose-cluster.yml | View in code |
![]() |
Container Traffic Not Bound To Host Interface | ...-compose-okta-cc.yml | View in code |
![]() |
Container Traffic Not Bound To Host Interface | ...mpose-okta-users.yml | View in code |
![]() |
Container Traffic Not Bound To Host Interface | ...cker-compose-wcs.yml | View in code |
![]() |
Container Traffic Not Bound To Host Interface | ...t/docker-compose.yml | View in code |
![]() |
Healthcheck Not Set | ...recated-api-test.yml | View in code |
![]() |
Healthcheck Not Set | ...recated-api-test.yml | View in code |
![]() |
Restart Policy On Failure Not Set To 5 | ...recated-api-test.yml | View in code |
![]() |
Healthcheck Not Set | ...er-compose-azure.yml | View in code |
![]() |
Restart Policy On Failure Not Set To 5 | ...er-compose-azure.yml | View in code |
![]() |
Healthcheck Not Set | ...-compose-cluster.yml | View in code |
![]() |
Healthcheck Not Set | ...-compose-cluster.yml | View in code |
![]() |
Restart Policy On Failure Not Set To 5 | ...-compose-cluster.yml | View in code |
![]() |
Healthcheck Not Set | ...-compose-okta-cc.yml | View in code |
![]() |
Restart Policy On Failure Not Set To 5 | ...-compose-okta-cc.yml | View in code |
![]() |
Healthcheck Not Set | ...mpose-okta-users.yml | View in code |
![]() |
Healthcheck Not Set | ...cker-compose-wcs.yml | View in code |
![]() |
Healthcheck Not Set | ...cker-compose-wcs.yml | View in code |
![]() |
Restart Policy On Failure Not Set To 5 | ...cker-compose-wcs.yml | View in code |
![]() |
Healthcheck Not Set | ...t/docker-compose.yml | View in code |
![]() |
Healthcheck Not Set | ...t/docker-compose.yml | View in code |
... | ... | ... | ... |
I've contributed to verba in the past but if there's anything i need to sign (CLA, etc) please let me know |
To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge. |
i agree |
Yes, I agree, that is definitely a confusing distinction between the two, and unnecessary by the looks of it. Good catch 👍 I am wondering, however, if this wouldn't be a breaking change, in a way. I.e., someone's
|
Could you check what was happening before in this case? I can't remember. |
I think we should add a deprecation notice to New(), I thought we did that a while back, but apparently not |
As @taigrr mentioned,
Agreed, document and deprecate would be the best way to resolve this. @taigrr would you like to update the PR, or should I just do that in a new one? |
Unfortunately many libraries I've seen are using the New() call and won't work anymore because they throw unauthorized error panics. I've mentioned one here, langchaingo. I presume they used to work, and the authorization flow here on the weaviate side was changed, and the breaking change is not my PR but rather some change that happened a ways back. For the sake of those other libraries I'd ask you to consider the change I presented once more, since in their current state they're completely broken, and a go get -u could fix them back to working status. However, a deprecation notice also makes sense for new users going forward, since calling panic on connect is not great, returning an error is clearly better. As an aside, the behavior is the same for unauthorized clients. (I apologize for formatting, responding from GitHub mobile)
I provided an AuthConfig, and it was ignored, and the call to New() threw a panic later as a result. If you still disagree, that's fine, I understand, just close my PR and make the new one. I'd just have to maintain my fork for now. |
Hey @taigrr, thanks for providing more details here. I'm going to take another look at it tomorrow to see what the best solution would be. Do I understand you correctly that libs like |
The User of langchaingo uses the weaviate vector provider, and passes it to an LLM tool array. On first execution calling the tool, the plugin attempts to search, weaviate responds with a 401 unauthorized error when the toolcalls run. Following their example code, this triggers a runtime panic, the usage of the weavaite client is opaque post-initialization. Additionally, if you try to provision schema in the init() call, which most will do, init() can't return an error, and most people panic here. New() itself of course doesn't panic, it just creates the client offline without actually connecting |
hi again @taigrr! This way a Client with a valid Auth config will be correctly authenticated whether it was created with func New(c Config) *Client {
if client, err := NewClient(c); err == nil {
return client
}
// ... current code of New()
} |
That sounds great. I've updated the PR and rebased to match |
add deprecation notice revert direct NewClient call follow suggestion from PR
We won't be changing the "panicking" code
Thank you for your contribution @taigrr 🙌 |
The
New()
function doesn't take the Auth options into account, which is confusing, since the two functions (New()
andNewClient()
) are otherwise identical.This PR unifies the logic, but preserves the
New()
function'spanic()
behavior and return signature for backwards compatibility.