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

Using same package across multiple proto files fails when multiple services are present #168

Closed
akesling opened this issue Dec 9, 2019 · 6 comments

Comments

@akesling
Copy link

akesling commented Dec 9, 2019

Bug Report

Version

$ cargo tree | grep tonic
foobar v0.1.0 (/Users/akesling/Devel/rust/tonic-break/foobar)
└── tonic v0.1.0-alpha.6
└── tonic-build v0.1.0-alpha.6

Platform

$ uname -a
Darwin notloh.lan 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64

Description

I've created an example project demonstrating the failure I'm seeing: https://github.com/akesling/tonic-break

When multiple proto files are provided, if they A) are in the same proto package and B) contain a service in more than one file, then compilation fails. Here's an example failure output: https://gist.github.com/akesling/4f1e026d17aa6376ce3213e79c8902b3

The issue seems to be that tonic-build is outputting multiple "pub mod client" stanzas. Everything works if only one file includes services.

Would it be possible to aggregate service definitions before codegen output to prevent stanza duplication like this?

@akesling
Copy link
Author

akesling commented Dec 9, 2019

The simplest stop-gap I've found for this is to move all service definitions into a single "services.proto" file per package. This is definitely sub-par but can at least unblock the issue.

@LucioFranco
Copy link
Member

Hi! Thanks for reporting, I believe this is a duplicate of #38?

@akesling
Copy link
Author

akesling commented Dec 9, 2019

Ah, I didn't read far enough into it. The observation in #38 (comment) is definitely the same issue. Is #38 multiple issues with codegen or am I missing something? If it is, should it be split up into one issue per specific user-visible behavior?

@LucioFranco
Copy link
Member

LucioFranco commented Dec 9, 2019

I think it relates to the same issue as having multiple services in the same proto package that gets compiled together. Not sure what to really break it up into though :/

@LucioFranco
Copy link
Member

I believe this should be fixed by #173, feel free to reopen is it doesnt!

@talksik
Copy link
Contributor

talksik commented Jun 7, 2023

I have this issue when we have /auth folder for protos and then a session.proto with just type definitions. Another file service.proto. Both in the same /auth directory, and both with package defined as auth. Problem is that configure/compile_proto runs for service.proto and then gets overwritten later on when compiling session.proto.

Anyone find a solution to this?

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

No branches or pull requests

3 participants