You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "alirezashamsabad (via GitHub)" <gi...@apache.org> on 2026/08/12 16:24:18 UTC

[PR] fix(grpc-transcode): resolve proto_id given as an integer [apisix]

alirezashamsabad opened a new pull request, #13811:
URL: https://github.com/apache/apisix/pull/13811

   ### Description
   
   `id_schema` allows a resource id to be either a string or an integer, and the
   `grpc-transcode` docs type `proto_id` as `string/integer`. But `create_proto_obj`
   compares the configured `proto_id` against the stored id with `==`, and in Lua
   `1 == "1"` is false. The admin API stores the id as a string, so any Route
   configuring `"proto_id": 1` fails to resolve its proto:
   
   ```
   proto load error: failed to find proto by id: 1
   ```
   
   Reproducer against master: two Routes over the same proto, one with the id as a
   string and one as an integer.
   
   ```shell
   curl "http://127.0.0.1:9180/apisix/admin/routes/1" -H "X-API-KEY: $admin_key" -X PUT -d '
   {
     "uri": "/str",
     "plugins": { "grpc-transcode": { "proto_id": "1", "service": "helloworld.Greeter", "method": "SayHello" } },
     "upstream": { "scheme": "grpc", "type": "roundrobin", "nodes": { "127.0.0.1:10051": 1 } }
   }'
   
   curl "http://127.0.0.1:9180/apisix/admin/routes/2" -H "X-API-KEY: $admin_key" -X PUT -d '
   {
     "uri": "/int",
     "plugins": { "grpc-transcode": { "proto_id": 1, "service": "helloworld.Greeter", "method": "SayHello" } },
     "upstream": { "scheme": "grpc", "type": "roundrobin", "nodes": { "127.0.0.1:10051": 1 } }
   }'
   ```
   
   `/str` transcodes, `/int` returns an error and logs `failed to find proto by id: 1`.
   
   This compares both sides as strings, matching how `graphql-proxy-cache` and
   `upstream.lua` already normalize ids.
   
   #### Which issue(s) this PR fixes:
   
   Fixes [#8952](https://github.com/apache/apisix/issues/8952), which was closed as
   stale without a fix. The report is still reproducible on master.
   
   ### Tests
   
   Two blocks added to `t/plugin/grpc-transcode.t`: a Route configured with an
   integer `proto_id`, and a request through it. Both fail without the change and
   pass with it.
   
   Developed with AI assistance; design decisions, review and testing are my own.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [ ] I have updated the documentation to reflect this change (not needed: the docs already type `proto_id` as `string/integer`; this makes the code match them)
   - [x] I have verified that this change is backward compatible (If it is not backward compatible, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(grpc-transcode): resolve proto_id given as an integer [apisix]

Posted by "alirezashamsabad (via GitHub)" <gi...@apache.org>.
alirezashamsabad commented on PR #13811:
URL: https://github.com/apache/apisix/pull/13811#issuecomment-5269644954

   Related: #13812 adds a feature to the same plugin. The two are independent and do
   not conflict; this one is the smaller, self-contained fix.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(grpc-transcode): resolve proto_id given as an integer [apisix]

Posted by "hanzhenfang (via GitHub)" <gi...@apache.org>.
hanzhenfang commented on PR #13811:
URL: https://github.com/apache/apisix/pull/13811#issuecomment-6489029265

   Hi @guoqqqi and @Baoyuantop, I’d like to follow up on this PR and help move it forward. Could you please assign it to me? Thanks!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] fix(grpc-transcode): resolve proto_id given as an integer [apisix]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13811:
URL: https://github.com/apache/apisix/pull/13811#issuecomment-6123382264

   This pull request has been marked as stale due to 60 days of inactivity. It will be closed in 4 weeks if no further activity occurs. If you think that's incorrect or this pull request should instead be reviewed, please simply write any comment. Even if closed, you can still revive the PR at any time or discuss it on the dev@apisix.apache.org list. Thank you for your contributions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org