[erlang-questions] cowboy throwing a routing error

Fred Hebert mononcqc@REDACTED
Thu Jan 10 15:53:06 CET 2013


It seems like you just passed through an env tuple and forgot to put it
in a list.

Note the usage of [{env, ...}], not just {env, ...}.

Regards,
Fred.

On 01/10, AD wrote:
> Hmm that helped, but now a different error about a compress param is
> showing up
> 
> Error in process <0.989.0> on node 'example@REDACTED' with exit value:
> {badarg,[{lists,keyfind,[compress,1,{env,[{dispatch,[{'_',[{[<<6
> bytes>>,'...'],sockjs_cowboy_handler,{service,"/socket",#Fun<example_sockjs_handler.0.4868432>,[{callback,example_callback}],"
> https://d1fxtkz8shb9d2.cloudfront.net/sockjs-0.3.min.js",false...
> 
> 
> 09:45:40.850 [error] Supervisor ranch_conns_sup had child ranch_conns_sup
> started with {ranch_conns_sup,start_protocol,undefined} at <0.989.0> exit
> with reason bad argument in call to lists:keyfind(compress, 1,
> {env,[{dispatch,[{'_',[{[<<"socket">>,'...'],sockjs_cowboy_handler,{service,"/socket",#Fun<outbre..>,...}},...]}]}]})
> in cowboy_protocol:get_value/3 line 97 in context child_terminated
> 
> 
> On Thu, Jan 10, 2013 at 9:24 AM, Fred Hebert <mononcqc@REDACTED> wrote:
> 
> > The latest cowboy now uses [{env, [{dispatch, Routes}]}] as its options
> > for the dispatching rather than the old format.
> >
> > I got the same error yesterday and this fixed it. The documentation didn't
> > follow through with the changes, but that's what we get for using the
> > bleeding edge rather than tagged versions.
> >
> > Regards,
> > Fred.
> >
> > On 01/10, AD wrote:
> > > hello,
> > >
> > >   Using sockjs and the latest cowboy/ranch, I am running into a badarg
> > > error with cowboy_router.  Not sure what is causing this, i captured the
> > > debug info here in this gist
> > >
> > > https://gist.github.com/4502255
> > >
> > > I am starting like this
> > >
> > > SockjsState = sockjs_handler:init_state(<<"/socket">>,fun
> > > wsocket_handler/3, state, []),
> > >
> > > VRoutes = [{[<<"socket">>, '...'], sockjs_cowboy_handler, SockjsState},
> > >
> > >                    {'_', ?MODULE, []}],
> > >  Routes = [{'_',  VRoutes}],
> > >
> > >  lager:info("Starting the cowboy listener on port
> > ~p..~n",[?COWBOY_HTTP_PORT]),
> > >
> > >  cowboy:start_http(my_http_listener, ?COWBOY_HTTP_ACCEPTORS, [{port,
> > > ?COWBOY_HTTP_PORT}], [{dispatch, Routes}]).
> > >
> > > But the call to lists:keyfind(dispatch, 1, Env) seems to be failing
> > > for some reason.
> > >
> > >  Any ideas ?
> > >
> > >  Thanks
> > > - AD
> >
> > > _______________________________________________
> > > erlang-questions mailing list
> > > erlang-questions@REDACTED
> > > http://erlang.org/mailman/listinfo/erlang-questions
> >
> >



More information about the erlang-questions mailing list