2016-09-07 5 views
0

카우보이로 만든 간단한 엔드 포인트를 치고있을 때이 오류 메시지를 확인하는 데 문제가 있습니다. 카우보이 (https://github.com/overture8/cow_app)로 간단한 앱을 만든 다음 rebar3 shell을 사용하여 앱을 시작했습니다 (이것이 맞는지 확실하지 않은 경우). 엔드 포인트를 타격 할 때 어쨌든,이 오류 받고 있어요 :Erlang Cowboy 앱으로 500 응답 받기

Error in process <0.232.0> with exit value: 
    {[{reason,undef}, 
     {mfa,{hello_handler,init,3}}, 
     {stacktrace, 
      [{hello_handler,init, 
       [{tcp,http}, 
       {http_req,#Port<0.7138>,ranch_tcp,keepalive,<0.232.0>,<<"GET">>, 
        'HTTP/1.1', 
        {{127,0,0,1},49651}, 
        <<"127.0.0.1">>,undefined,8010,<<"/">>,undefined,<<>>, 
        undefined,[], 
        [{<<"host">>,<<"127.0.0.1:8010">>}, 
        {<<"connection">>,<<"keep-alive">>}, 
        {<<"cache-control">>,<<"max-age=0">>}, 
        {<<"upgrade-insecure-requests">>,<<"1">>}, 
        {<<"user-agent">>, 
         <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36">>}, 
        {<<"accept">>, 
         <<"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8">>}, 
        {<<"dnt">>,<<"1">>}, 
        {<<"accept-encoding">>,<<"gzip, deflate, sdch">>}, 
        {<<"accept-language">>, 
         <<"en-GB,en;q=0.8,en-US;q=0.6,fr;q=0.4">>}], 
        [{<<"connection">>,[<<"keep-alive">>]}], 
        undefined,[],waiting,<<>>,undefined,false,waiting,[],<<>>, 
        undefined}, 
       []], 
       []}, 
       . 
       . 
       . 

어쩌면 난 그냥 완전히 잘못 뭔가를하고 있어요 -이 얼랑를 사용하여 내 첫 경험이다.

도움을 주시면 감사하겠습니다. 귀하의 rebar.lock

+0

나는 Mac을 사용하고 있으며 'brew install erlang'을 사용하여 Erlang을 설치하고 있습니다. 내가 설치 한 버전은 "Erlang/OTP 19 [erts-8.0.2]"입니다. – overture8

답변

1

rebar.config와 동기화되지 어떤 오류 ... {reason,undef}, {mfa,{hello_handler,init,3}}, ... 수단 인하지 init/2, 내보낼 수 init/3을 필요로 카우보이의 버전 1.0.1를 가리키고 있습니다.

해결하려면 rebar3 upgrade cowboy을 실행 한 다음 rebar3 shell을 실행하십시오. 내가 그것을 실행하면, 응용 프로그램이 나를 위해 잘 작동합니다 :

$ curl -i http://localhost:8010/ 
HTTP/1.1 200 OK 
server: Cowboy 
date: Wed, 07 Sep 2016 09:57:22 GMT 
content-length: 13 
content-type: text/plain 

Hello Erlang! 
+0

정말 고마워! 지금 일하고있어. – overture8