You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/01/09 11:20:48 UTC

[GitHub] [apisix-java-plugin-runner] leyuuu opened a new issue #112: request help: Can't get request header.

leyuuu opened a new issue #112:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/112


   ### Issue description
   ```
   java.lang.IndexOutOfBoundsException: null
           at java.nio.Buffer.checkIndex(Buffer.java:693) ~[?:?]
           at java.nio.DirectByteBuffer.getInt(DirectByteBuffer.java:758) ~[?:?]
           at com.google.flatbuffers.Table.__vector_len(Table.java:125) ~[flatbuffers-java-2.0.0.jar!/:?]
           at io.github.api7.A6.HTTPReqCall.Req.headersLength(Req.java:37) ~[A6-0.3.0-RELEASE.jar!/:?]
           at org.apache.apisix.plugin.runner.HttpRequest.getHeader(HttpRequest.java:141) ~[apisix-runner-plugin-sdk-0.1.0.jar!/:0.1.0]
           at org.apache.apisix.plugin.runner.HttpRequest.getHeader(HttpRequest.java:164) ~[apisix-runner-plugin-sdk-0.1.0.jar!/:0.1.0]
           at org.apache.apisix.plugin.runner.filter.Test.filter(Test.java:41) ~[apisix-runner-plugin-0.1.0.jar!/:0.1.0]
           at org.apache.apisix.plugin.runner.filter.PluginFilterChain.filter(PluginFilterChain.java:53) ~[apisix-runner-plugin-sdk-0.1.0.jar!/:0.1.0]
           at org.apache.apisix.plugin.runner.handler.HTTPReqCallHandler.doFilter(HTTPReqCallHandler.java:121) ~[apisix-runner-core-0.1.0.jar!/:0.1.0]
           at org.apache.apisix.plugin.runner.handler.HTTPReqCallHandler.handleExtraInfo(HTTPReqCallHandler.java:105) ~[apisix-runner-core-0.1.0.jar!/:0.1.0]
           at org.apache.apisix.plugin.runner.handler.HTTPReqCallHandler.channelRead0(HTTPReqCallHandler.java:78) [apisix-runner-core-0.1.0.jar!/:0.1.0]
           at org.apache.apisix.plugin.runner.handler.HTTPReqCallHandler.channelRead0(HTTPReqCallHandler.java:51) [apisix-runner-core-0.1.0.jar!/:0.1.0]
           at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at org.apache.apisix.plugin.runner.handler.PrepareConfHandler.channelRead0(PrepareConfHandler.java:55) [apisix-runner-core-0.1.0.jar!/:0.1.0]
           at org.apache.apisix.plugin.runner.handler.PrepareConfHandler.channelRead0(PrepareConfHandler.java:44) [apisix-runner-core-0.1.0.jar!/:0.1.0]
           at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at org.apache.apisix.plugin.runner.handler.PayloadDecoder.channelRead0(PayloadDecoder.java:44) [apisix-runner-core-0.1.0.jar!/:0.1.0]
           at org.apache.apisix.plugin.runner.handler.PayloadDecoder.channelRead0(PayloadDecoder.java:37) [apisix-runner-core-0.1.0.jar!/:0.1.0]
           at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.handler.logging.LoggingHandler.channelRead(LoggingHandler.java:271) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:795) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.epoll.EpollDomainSocketChannel$EpollDomainUnsafe.epollInReady(EpollDomainSocketChannel.java:138) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:480) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-all-4.1.63.Final.jar!/:4.1.63.Final]
           at java.lang.Thread.run(Thread.java:829) [?:?]
   ```
   
   
   ```
   @Component
   public class Test implements PluginFilter {
   
       private final Logger logger = LoggerFactory.getLogger(Test.class);
   
       @Override
       public String name() {
           return "Test";
       }
   
       @Override
       public void filter(HttpRequest request, HttpResponse response, PluginFilterChain chain) {
           String auth = request.getHeader("authorization");
           chain.filter(request, response);
       }
   
       /**
        * If you need to fetch some Nginx variables in the current plugin, you will need to declare them in this function.
        * @return a list of Nginx variables that need to be called in this plugin
        */
       @Override
       public List<String> requiredVars() {
           List<String> vars = new ArrayList<>();
           vars.add("remote_addr");
           vars.add("server_port");
           vars.add("route_id");
           return vars;
       }
   
       /**
        * If you need to fetch request body in the current plugin, you will need to return true in this function.
        */
       @Override
       public Boolean requiredBody() {
           return false;
       }
   }
   
   ```
   ### Environment
   
   * your apisix-java-plugin-runner version
   * 0.1.0 Commits on Jan 4, 2022
   
   Apisix environment:
   - apache/apisix-dashboard:2.10.1-alpine with openjdk11 container
   


-- 
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



[GitHub] [apisix-java-plugin-runner] tzssangglass closed issue #112: request help: Can't get request header when the requiredVars value is given

Posted by GitBox <gi...@apache.org>.
tzssangglass closed issue #112:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/112


   


-- 
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



[GitHub] [apisix-java-plugin-runner] leyuuu edited a comment on issue #112: request help: Can't get request header.

Posted by GitBox <gi...@apache.org>.
leyuuu edited a comment on issue #112:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/112#issuecomment-1008307624


   This only error when return `requiredVars` was not empty.
   
   Can you check it? 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



[GitHub] [apisix-java-plugin-runner] leyuuu edited a comment on issue #112: request help: Can't get request header when the requiredVars value is given

Posted by GitBox <gi...@apache.org>.
leyuuu edited a comment on issue #112:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/112#issuecomment-1008307624


   This only error when return `requiredVars` was not empty.
   
   If I fill `requiredVars` then I can't get Header.
   otherwise, I can't get variable.
   
   Can you check it? 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



[GitHub] [apisix-java-plugin-runner] leyuuu closed issue #112: request help: Can't get request header.

Posted by GitBox <gi...@apache.org>.
leyuuu closed issue #112:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/112


   


-- 
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



[GitHub] [apisix-java-plugin-runner] leyuuu commented on issue #112: request help: Can't get request header.

Posted by GitBox <gi...@apache.org>.
leyuuu commented on issue #112:
URL: https://github.com/apache/apisix-java-plugin-runner/issues/112#issuecomment-1008307624


   But if I remove Koltin support it just working fine.
   Close it now. If this project upgrade spring boot version, I'll try again.


-- 
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