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

[protoc-gen-tonic] Minimal.rs: Tried to insert into file that doesn't exist. #10

Closed
muusbolla opened this issue Jun 2, 2022 · 4 comments · Fixed by #13
Closed

[protoc-gen-tonic] Minimal.rs: Tried to insert into file that doesn't exist. #10

muusbolla opened this issue Jun 2, 2022 · 4 comments · Fixed by #13

Comments

@muusbolla
Copy link

muusbolla commented Jun 2, 2022

Running any of the below commands all give the same error + exit code 1: "Minimal.rs: Tried to insert into file that doesn't exist."
protoc --tonic_out=. ./minimal.proto
protoc --prost-crate_out=. ./minimal.proto // actually gives "Cargo.toml: Tried to insert into file that doesn't exist."
protoc --prost-serde_out=. ./minimal.proto

The below commands work:
protoc --prost_out=. ./minimal.proto // produces Minimal.rs file with proto declaration but no GRPC service, as expected
protoc --tonic_out=. --tonic_opt=no_client=true,no_server=true ./minimal.proto // generates nothing
protoc --go-grpc_out=. ./min.proto // generates a go service as expected, just for example

Minimal proto that causes this issue:

syntax = "proto3";
package Minimal;
option go_package="test.minimal"

// The request message
message ExampleRequest {
  string name = 1;
}

// The response message
message ExampleReply {
  string message = 1;
}

// The service definition
service Example {
  // Declare one RPC
  rpc ExampleRpc (ExampleRequest) returns (ExampleReply) {}
}

OS: Ubuntu 20.04 LTS

protoc --version: libprotoc 3.6.1

cargo install --list | grep protoc:
protoc-gen-prost v0.1.3:
protoc-gen-prost
protoc-gen-prost-crate v0.1.5:
protoc-gen-prost-crate
protoc-gen-prost-serde v0.1.0:
protoc-gen-prost-serde
protoc-gen-tonic v0.1.0:
protoc-gen-tonic

@neoeinstein
Copy link
Owner

neoeinstein commented Jun 2, 2022

The tonic generator relies and builds on the artifacts provided by the prost generator. We could add an option not to append to that seed file, but the tonic generator isn't standalone and would rely on the generated prost files anyway.

While the documentation references usage with buf, the same restriction applies if you are invoking it via protoc directly.

The same is true and specified for the crate and serde generators.

@muusbolla
Copy link
Author

muusbolla commented Jun 2, 2022

After running protoc --prost_out=. ./minimal.proto , the file Minimal.rs exists in the folder. Then I run protoc --tonic_out=. ./minimal.proto and I get the error "Minimal.rs: Tried to insert into file that doesn't exist." Can you be more specific about what I'm doing wrong?

@neoeinstein
Copy link
Owner

I'll take a look and see if I can reproduce as you have. I do less running manually with protoc and more using buf so there may be some options that are missing.

@titanous
Copy link
Contributor

I pushed a workaround in #13.

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 a pull request may close this issue.

3 participants