Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

I cannot set in .rr.yml Proto which includes other protos #15

Closed
oneslash opened this issue Apr 23, 2019 · 12 comments
Closed

I cannot set in .rr.yml Proto which includes other protos #15

oneslash opened this issue Apr 23, 2019 · 12 comments

Comments

@oneslash
Copy link

I cannot set in .rr.yml Proto which includes other protos.

It does not work for some reason

@wolfy-j
Copy link
Member

wolfy-j commented Apr 23, 2019

Can you attach sample proto file and describe the issue in more details.

@oneslash
Copy link
Author

oneslash commented Apr 23, 2019

Category.proto

syntax = "proto3";
package pim.v1;

message Category {
    uint32 id = 1;
    string name = 2;
}

Product.proto

syntax = "proto3";
package product;
import "v1/category.proto";

message Product {
    uint32 id = 1;
    string name = 2;
    Category primary_category = 3;
}

and my .rr.yml is


grpc:
  listen: "tcp://:9001"
  proto: "./vendor/app/product.proto"
  workers:
    command: "php app.php"
    pool:
      numWorkers: 4

@wolfy-j
Copy link
Member

wolfy-j commented Apr 23, 2019

What is the error you experiencing? I'm not seeing any services defined in your proto files, have you generated your service code?

@oneslash
Copy link
Author

@wolfy-j yes, I have services, in both files.

service CategoryService {
    rpc CreateCategory (CategoryCreateRequest) returns (CategoryCreateResponse) {};

    rpc ReadCategory (CategoryReadRequest) returns (CategoryReadResponse) {};
}
ProductService {
    // Price Related
    rpc UpdatePrice (ProductPriceRequest) returns (ProductPriceResponse) {}
}

@oneslash
Copy link
Author

error is it cannot find the service in category

@wolfy-j
Copy link
Member

wolfy-j commented Apr 23, 2019

It would be hard for me to identify the issue this way. If you can post the minimal reproducible version of your code it would help a lot.

When you saying "error is it cannot find the service in category", do you mean it is not able to generate the code for this service or this service does not respond on GPRC request?

@oneslash
Copy link
Author

the error was

{
 “error”: “12 UNIMPLEMENTED: unknown service pim.v1.CategoryService”
}

If it is not enough we can try to send a small code

@oneslash oneslash reopened this Apr 23, 2019
@wolfy-j
Copy link
Member

wolfy-j commented Apr 23, 2019

Yes, please submit the code sample. Thank you

@oneslash
Copy link
Author

so there is the commit with changes https://github.com/oneslash/php-grpc/commit/3b878bb5b4df94fba5174e3c40a252d8ff0b784a

the test TestParseFile will fail since it can't find two services

func TestParseFile(t *testing.T) {
	services, err := File("test.proto")
	assert.NoError(t, err)
	assert.Len(t, services, 2)

	assert.Equal(t, "app.namespace", services[0].Package)
}

@wolfy-j
Copy link
Member

wolfy-j commented Apr 26, 2019

Thank you, this helps a lot.

@wolfy-j
Copy link
Member

wolfy-j commented Apr 26, 2019

Fixed in 1.0.4

@wolfy-j wolfy-j closed this as completed Apr 26, 2019
@oneslash
Copy link
Author

Thank you, I will check soon and report back if it works

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants