2016-09-07 5 views
0

私はCowboyで作成した単純なエンドポイントを打つときにこのエラーメッセージを解読するのに問題があります。私はカウボーイ(https://github.com/overture8/cow_app)で簡単なアプリを作成し、rebar3 shellを使ってアプリを起動しました(これが正しいかどうかはわかりません)。エンドポイントを打つときとにかく、私はこのエラーを取得しています:Erlang Cowboy appで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

関連する問題