Skip to content

Unexpected HTTP/1.x request: OPTIONS #581

@cinling

Description

@cinling

The context

What do you wish to achieve?

  1. Let Server communicate with grpc-web
    or
  2. grpc-server-spring-boot-starter is compatible with http/1.x protocol

The bug

What's the problem? What's not working? What do you expect to happen.

Stacktrace and logs

io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2Exception: Unexpected HTTP/1.x request: OPTIONS /net.cinling.appbill.grpc.UserProto/IsMailReg 
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:103) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.readClientPrefaceString(Http2ConnectionHandler.java:302) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:239) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:438) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:501) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:440) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[grpc-netty-shaded-1.37.0.jar:1.37.0]
	at java.base/java.lang.Thread.run(Thread.java:831) ~[na:na]

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

The application's environment

Which versions do you use?

  • Spring (boot):2.5.4
  • grpc-java:1.40.1
  • grpc-spring-boot-starter:2.12.0.RELEASE
  • java: version + architecture (64bit?). OpenJDK 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)
  • Other relevant libraries...
  • grpc Client[node.js]:
  • @ngx-grpc/* 2.3.0
  • google-protobuf 3.17.3
  • grpc-web 1.2.1

Additional context

  • Did it ever work before?
    NO
  • Do you have a demo?
    NO

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething does not work as expectedfeedback requiredInformation are missing or feedback for suggestions is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions