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

Improve errors for outdated protobuf runtimes #465

Merged
merged 1 commit into from
Feb 18, 2023
Merged

Conversation

akshayjshah
Copy link
Member

When users try to use Connect with types generated by v1 of the protobuf
runtime (github.com/golang/protobuf), they get a generic message
complaining that their type doesn't implement proto.Message. This is
confusing, because the message does implement a proto.Message
interface - just from a different proto package. This PR adds a bit of
logic to the protobuf codecs to provide better errors in this case.

This error message is intentionally long: it uses
"github.com/golang/protobuf" and "google.golang.org/protobuf" rather
than "v1" and "v2" to avoid confusion with proto2 and proto3, and it
includes a link to a Go blog post that explains the migration in detail.

@cyriltovena ran into this, as did a few other other users I've spoken to.
Let's save them some debugging time :)

When users try to use Connect with types generated by v1 of the protobuf
runtime (github.com/golang/protobuf), they get a generic message
complaining that their type doesn't implement `proto.Message`. This is
confusing, because the message does implement a `proto.Message`
interface - just from a different `proto` package. This PR adds a bit of
logic to the protobuf codecs to provide better errors in this case.

This error message is intentionally long: it uses
"github.com/golang/protobuf" and "google.golang.org/protobuf" rather
than "v1" and "v2" to avoid confusion with proto2 and proto3, and it
includes a link to a Go blog post that explains the migration in detail.
@akshayjshah akshayjshah merged commit 651016d into main Feb 18, 2023
@akshayjshah akshayjshah deleted the ajs/protov1 branch February 18, 2023 00:16
renovate bot referenced this pull request in open-feature/flagd Apr 14, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[github.com/bufbuild/connect-go](https://togithub.com/bufbuild/connect-go)
| require | minor | `v1.5.2` -> `v1.6.0` |

---

### Release Notes

<details>
<summary>bufbuild/connect-go</summary>

###
[`v1.6.0`](https://togithub.com/bufbuild/connect-go/releases/tag/v1.6.0)

[Compare
Source](https://togithub.com/bufbuild/connect-go/compare/v1.5.2...v1.6.0)

<!-- Release notes generated using configuration in .github/release.yml
at main -->

#### What's Changed

##### Enhancements

- Improve comments & add procedure consts to generated code by
[@&#8203;akshayjshah](https://togithub.com/akshayjshah) in
[https://github.com/bufbuild/connect-go/pull/480](https://togithub.com/bufbuild/connect-go/pull/480)
- Reduce per-call URL parsing cost by
[@&#8203;mattrobenolt](https://togithub.com/mattrobenolt) in
[https://github.com/bufbuild/connect-go/pull/467](https://togithub.com/bufbuild/connect-go/pull/467)
- Improve errors for outdated protobuf runtimes by
[@&#8203;akshayjshah](https://togithub.com/akshayjshah) in
[https://github.com/bufbuild/connect-go/pull/465](https://togithub.com/bufbuild/connect-go/pull/465)
- Switch README to use `buf curl` by
[@&#8203;akshayjshah](https://togithub.com/akshayjshah) in
[https://github.com/bufbuild/connect-go/pull/474](https://togithub.com/bufbuild/connect-go/pull/474)

##### Bugfixes

- Clarify purpose of handler_stream_test.go by
[@&#8203;Hirochon](https://togithub.com/Hirochon) in
[https://github.com/bufbuild/connect-go/pull/472](https://togithub.com/bufbuild/connect-go/pull/472)
- Make StreamType constants typed numerics by
[@&#8203;jhump](https://togithub.com/jhump) in
[https://github.com/bufbuild/connect-go/pull/486](https://togithub.com/bufbuild/connect-go/pull/486)
- Populate Spec and Peer in Client.CallServerStream by
[@&#8203;jhump](https://togithub.com/jhump) in
[https://github.com/bufbuild/connect-go/pull/487](https://togithub.com/bufbuild/connect-go/pull/487)

#### New Contributors

- [@&#8203;Hirochon](https://togithub.com/Hirochon) made their first
contribution in
[https://github.com/bufbuild/connect-go/pull/472](https://togithub.com/bufbuild/connect-go/pull/472)

**Full Changelog**:
bufbuild/connect-go@v1.5.2...v1.6.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://app.renovatebot.com/dashboard#github/open-feature/flagd).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS4zMS40IiwidXBkYXRlZEluVmVyIjoiMzUuMzEuNCJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
akshayjshah added a commit that referenced this pull request Jul 26, 2023
When users try to use Connect with types generated by v1 of the protobuf
runtime (github.com/golang/protobuf), they get a generic message
complaining that their type doesn't implement `proto.Message`. This is
confusing, because the message does implement a `proto.Message`
interface - just from a different `proto` package. This PR adds a bit of
logic to the protobuf codecs to provide better errors in this case.

This error message is intentionally long: it uses
"github.com/golang/protobuf" and "google.golang.org/protobuf" rather
than "v1" and "v2" to avoid confusion with proto2 and proto3, and it
includes a link to a Go blog post that explains the migration in detail.

@cyriltovena ran into this, as did a few other other users I've spoken
to. Let's save them some debugging time :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants