(webtest@127.0.0.1)1> =CRASH REPORT==== 12-Jul-2020::13:04:42.355875 ===
crasher:
initial call: cowboy_stream_h:request_process/3
pid: <0.480.0>
registered_name: []
exception error: bad argument: "Can't resolve the priv_dir of application webtest_app"
in function cowboy_static:priv_path/2 (src/cowboy_static.erl, line 72)
in call from cowboy_static:init_opts/2 (src/cowboy_static.erl, line 59)
in call from cowboy_handler:execute/2 (src/cowboy_handler.erl, line 37)
in call from cowboy_stream_h:execute/3 (src/cowboy_stream_h.erl, line 300)
in call from cowboy_stream_h:request_process/3 (src/cowboy_stream_h.erl, line 291)
ancestors: [<0.479.0>,<0.447.0>,<0.446.0>,ranch_sup,<0.435.0>]
message_queue_len: 0
messages: []
links: [<0.479.0>]
dictionary: []
trap_exit: false
status: running
heap_size: 987
stack_size: 28
reductions: 364
neighbours:
=ERROR REPORT==== 12-Jul-2020::13:04:42.356857 ===
Ranch listener my_http_listener, connection process <0.479.0>, stream 1 had its request process <0.480.0> exit with reason {badarg,"Can't resolve the priv_dir of application webtest_app"} and stacktrace [{cowboy_static,priv_path,2,[{file,"src/cowboy_static.erl"},{line,72}]},{cowboy_static,init_opts,2,[{file,"src/cowboy_static.erl"},{line,59}]},{cowboy_handler,execute,2,[{file,"src/cowboy_handler.erl"},{line,37}]},{cowboy_stream_h,execute,3,[{file,"src/cowboy_stream_h.erl"},{line,300}]},{cowboy_stream_h,request_process,3,[{file,"src/cowboy_stream_h.erl"},{line,291}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,226}]}]
Dispatch = cowboy_router:compile([
{'_',
[
% {"/test", hello_handler, []},
{"/", cowboy_static, {priv_file, webtest, "login.html"}}
]
}
]),
原因:
{"/", cowboy_static, {priv_file, webtest, "login.html"}} 中的webtest必须和文件ebin\webtest.app
里面的application配置的名字一样。