kingluo opened a new issue, #9228:
URL: https://github.com/apache/apisix/issues/9228

   ### Current Behavior
   
   hold_body_chunk uses a global buffer associated with the request context, 
then if two plugins use it to hold the body, the plugin with a smaller priority 
will get nil, because the `ctx._body_buffer` is reset after the body collection 
is finished.
   
   
https://github.com/apache/apisix/blob/809ba09b26ddd62e0efa612f85e90d1aa938ce02/apisix/core/response.lua#L195-L204
   
   **Use case:**
   
   The body-transformer plugin should use the body provided by the proxy-cache 
plugin. They both use `hold_body_chunk()`.
   
   ### Expected Behavior
   
   hold_body_chunk should use a specified buffer if provided, other than 
`ctx._body_buffer`.
   
   ### Error Logs
   
   2023/04/03 17:13:25 [error] 2707597#2707597: *227 [lua] 
body-transformer.lua:145: transform(): response template rendering: [string 
"context=... or {}..."]:7: attempt t
   o index global 'Envelope' (a nil value) while sending to client, client: 
127.0.0.1, server: _, request: "POST /capital HTTP/1.1", upstream: 
"http://127.0.0.1:3000/websa
   mples.countryinfo/CountryInfoService.wso", host: "127.0.0.1:9080"
   
   
   ### Steps to Reproduce
   
   Refer to #9226
   
   ### Environment
   
   - APISIX version (run `apisix version`): master
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to