-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New version of cowboy throw exception #3
Comments
i've just seen this same issue testing with cowboy 2.7.0 and prometheus_cowboy 0.1.7 |
i have some more info on this, in my case at least it looks like arguably user error. but perhaps the cowboy code could be strengthened here too. i think this points to cowboy itself rather than prometheus? will open a ticket there im writing a test using lhttpc and have a wrapper function that takes in a method and a proplist, it encodes the proplist to json and it becomes the request body. the problem occurs when the method is one that doesn't need (or shouldn't have?) a body. this line of code is highlighted in the stacktrace, so i debugged the "Buffer" value: i make the request: lhttpc:request( "http://127.0.0.1:8088/v3/myendpoint?arg1=1&arg2=2", "DELETE", [{<<"authorization">>, <<"Bearer ", JWT/binary>>}], <<"[]">>, 1000). this succeeds with the expected 204 response and cowboy_http.erl#L310 is executed twice: Buffer = <<"DELETE /v3/myendpoint?arg1=1&arg2=2 HTTP/1.1\r\nauthorization: Bearer XXXXXXXXXXX\r\nHost: 127.0.0.1:8088\r\n\r\n[]">> Buffer = <<"[]">> the i immediately make the request: lhttpc:request( "http://127.0.0.1:8088/v3/myendpoint?arg1=1&arg2=2", "GET", [{<<"authorization">>, <<"Bearer ", JWT/binary>>}], <<"[]">>, 1000). the client gets an unexpected 400 response and cowboy_http.erl#L310 is executed once with this dodgy looking data that includes the body from the previous response: Buffer = <<"[]GET /v3/myendpoint?arg1=1&arg2=2 HTTP/1.1\r\nauthorization: Bearer XXXXXXXXXXX\r\nHost: 127.0.0.1:8088\r\n\r\n[]">> on the server this is accompanied with the error: 10:27:47.825 UTC [error] Unhandled exception error:function_clause in cowboy_stream:early_error(2, Reason, PartialReq, Resp, Opts) everything works fine when i fix my code and ensure that these requests are made with no body. |
Hello,
I encountered this problem when I used prometheus-cowboy:
I think this may be related to the cowboy's version what I use.
prometheus_cowboy version :
0.1.7
cowboy version :
2.6.1
The text was updated successfully, but these errors were encountered: