Tried but failed Nitrogen Elements demo

20 views
Skip to first unread message

Wes James

unread,
Oct 31, 2015, 11:34:13 PM10/31/15
to Nitrogen Project / The Nitrogen Web Framework for Erlang
I tried the demo from:


but it fails.  Is that because it is to old for the current nitrogen?  It has a link on the nitrogen downloads page.

Thanks,

-wes


Jesse Gumm

unread,
Oct 31, 2015, 11:52:57 PM10/31/15
to nitrogenweb
Hi Wes,

It may indeed be a bit old. I haven't played with it for a while.

What is the error message you're receiving?

-Jesse
> --
> You received this message because you are subscribed to the Google Groups
> "Nitrogen Project / The Nitrogen Web Framework for Erlang" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nitrogenweb...@googlegroups.com.
> To post to this group, send email to nitro...@googlegroups.com.
> Visit this group at http://groups.google.com/group/nitrogenweb.
> For more options, visit https://groups.google.com/d/optout.



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Wes James

unread,
Oct 31, 2015, 11:53:18 PM10/31/15
to Nitrogen Project / The Nitrogen Web Framework for Erlang
I forgot to mention, I began with downloading erlang 18.1, but rebar didn't work with that so I went back to 17.x and it worked there. So I'm on a mac and erlang is working, but the elements  demo errors out with nitrogen/cowboy git cloned 

Wes James

unread,
Oct 31, 2015, 11:58:41 PM10/31/15
to nitro...@googlegroups.com
Starting Sync (Automatic Code Compiler / Reloader)
Scanning source files...
sync
crypto
ranch
cowboy
Starting Cowboy Server 8000 
nitrogen_elements_examples

It stops here then when I go to localhost:8000 the errors below show up:

=INFO REPORT==== 31-Oct-2015::21:55:12 ===
{error,error,undef,
    [{sbw,post_param,
         [<<"pageContext">>,
          {simple_bridge_request_wrapper,cowboy_request_bridge,
              {cowboy_bridge,#Ref<0.0.0.1890>},
              false,[],[],none}],
         []},
     {wf_core,deserialize_request_context,0,
         [{file,"src/wf_core.erl"},{line,146}]},
     {wf_core,run_catched,0,[{file,"src/wf_core.erl"},{line,82}]},
     {wf_core,run,0,[{file,"src/wf_core.erl"},{line,23}]},
     {nitrogen_cowboy,handle,2,[{file,"src/nitrogen_cowboy.erl"},{line,22}]},
     {cowboy_handler,handler_handle,4,
         [{file,"src/cowboy_handler.erl"},{line,119}]},
     {cowboy_protocol,execute,4,
         [{file,"src/cowboy_protocol.erl"},{line,523}]}]}

=INFO REPORT==== 31-Oct-2015::21:55:12 ===
{error,error,undef,
    [{simple_bridge_request_wrapper,set_status_code,
         [500,
          {simple_bridge_request_wrapper,cowboy_request_bridge,
              {cowboy_bridge,#Ref<0.0.0.1890>},
              false,[],[],none}],
         []},
     {wf_context,status_code,1,[{file,"src/lib/wf_context.erl"},{line,190}]},
     {wf,status_code,1,[{file,"src/wf.erl"},{line,272}]},
     {default_crash_handler,first_request,5,
         [{file,"src/handlers/crash/default_crash_handler.erl"},{line,19}]},
     {wf_core,run_crashed_first_request,3,
         [{file,"src/wf_core.erl"},{line,206}]},
     {wf_core,run_crash,4,[{file,"src/wf_core.erl"},{line,44}]},
     {nitrogen_cowboy,handle,2,[{file,"src/nitrogen_cowboy.erl"},{line,22}]},
     {cowboy_handler,handler_handle,4,
         [{file,"src/cowboy_handler.erl"},{line,119}]}]}

=ERROR REPORT==== 31-Oct-2015::21:55:12 ===
** Cowboy handler nitrogen_cowboy terminating in handle/2
   for the reason error:undef
** Handler state was {state,undefined,undefined}
** Request was [{socket,#Port<0.1857>},
                {transport,ranch_tcp},
                {connection,keepalive},
                {pid,<0.231.0>},
                {method,<<"GET">>},
                {version,'HTTP/1.1'},
                {peer,{{127,0,0,1},58165}},
                {host,<<"localhost">>},
                {host_info,undefined},
                {port,8000},
                {path,<<"/">>},
                {path_info,undefined},
                {qs,<<>>},
                {qs_vals,undefined},
                {bindings,[]},
                {headers,[{<<"host">>,<<"localhost:8000">>},
                          {<<"accept">>,
                           <<"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8">>},
                          {<<"accept-language">>,<<"en-us">>},
                          {<<"connection">>,<<"keep-alive">>},
                          {<<"accept-encoding">>,<<"gzip, deflate">>},
                          {<<"user-agent">>,
                           <<"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/601.2.7 (KHTML, like Gecko) Version/9.0.1 Safari/601.2.7">>}]},
                {p_headers,[{<<"connection">>,[<<"keep-alive">>]}]},
                {cookies,undefined},
                {meta,[]},
                {body_state,waiting},
                {multipart,undefined},
                {buffer,<<>>},
                {resp_compress,false},
                {resp_state,waiting},
                {resp_headers,[]},
                {resp_body,<<>>},
                {onresponse,undefined}]
** Stacktrace: [{sbw,set_status_code,
                    [500,
                     {simple_bridge_request_wrapper,cowboy_request_bridge,
                         {cowboy_bridge,#Ref<0.0.0.1890>},
                         false,[],[],none}],
                    []},
                {wf_core,run_crash,4,[{file,"src/wf_core.erl"},{line,52}]},
                {nitrogen_cowboy,handle,2,
                    [{file,"src/nitrogen_cowboy.erl"},{line,22}]},
                {cowboy_handler,handler_handle,4,
                    [{file,"src/cowboy_handler.erl"},{line,119}]},
                {cowboy_protocol,execute,4,
                    [{file,"src/cowboy_protocol.erl"},{line,523}]}]

Jesse Gumm

unread,
Nov 1, 2015, 12:24:40 AM11/1/15
to nitrogenweb
Thanks, nitrogen_elements isn't supposed to be made as a standalone
project, but there is a nitrogen_elements_examples, which uses
nitrogen_elements to demonstrate the capabilities:

https://github.com/RomanShestakov/nitrogen_elements_examples

But after cloning that, be sure to update cowboy line in rebar.config to:
{cowboy, ".*", {git, "git://github.com/ninenines/cowboy", {tag, "1.0.1"}}},

That *should* work, but again, I haven't played with it in a while,

-Jesse

Wes James

unread,
Nov 1, 2015, 11:09:51 AM11/1/15
to nitro...@googlegroups.com
Right.  I was going through the example at the bottom of that repo.

-wes

Jesse Gumm

unread,
Nov 1, 2015, 12:13:04 PM11/1/15
to nitrogenweb
Hi Wes,

My apologies for the late night semi-dilirious responses.

As you've noticed, nitrogen_element has not been maintained, and
nitrogen has had a number of new versions since then. The biggest
change was the migration to simple_bridge 2.0, which is what is
throwing the errors in your load process. I'm having a gander at this
now to see if I can put together a quick fix to get it properly
working.

I'll let you know,

-Jesse

Jesse Gumm

unread,
Nov 1, 2015, 12:49:26 PM11/1/15
to nitrogenweb
Hi Wes,

I've done some preliminary reworking to make sure it works with
Nitrogen 2.3, give this a shot:

https://github.com/choptastic/nitrogen_elements_examples

There's much more to do about this, but given the languishment that
nitrogen_elements has had, I think I'm going to take the time to break
it into individual plugins, since they are, on their own, a handful of
completely unrelated elements.

But seeing that your question to Erlang-questions was related to
working with tabs, I made sure the tabs bit works appropriately.

-Jesse

Wes James

unread,
Nov 1, 2015, 3:32:24 PM11/1/15
to nitro...@googlegroups.com
Thanks Jesse.  I'll take a look at this again.

-wes

Wes James

unread,
Nov 1, 2015, 5:56:25 PM11/1/15
to nitro...@googlegroups.com
I'm getting this error now:

=INFO REPORT==== 1-Nov-2015::15:17:19 ===
{error,first_request,
    {url,"localhost:8000/"},
    {error,
        {case_clause,{secure,false}},
        [{cow_cookie,setcookie,3,[{file,"src/cow_cookie.erl"},{line,198}]},
         {cowboy_req,set_resp_cookie,4,
             [{file,"src/cowboy_req.erl"},{line,755}]},
         {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
         {cowboy_simple_bridge,send,5,
             [{file,"src/cowboy_bridge_modules/cowboy_simple_bridge.erl"},
              {line,226}]},
         {cowboy_simple_bridge,build_response,2,
             [{file,"src/cowboy_bridge_modules/cowboy_simple_bridge.erl"},
              {line,175}]},
         {wf_core,run,0,[{file,"src/wf_core.erl"},{line,23}]},
         {cowboy_simple_bridge_anchor,handle,2,
             [{file,
                  "src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},
              {line,34}]},
         {cowboy_handler,handler_handle,4,
             [{file,"src/cowboy_handler.erl"},{line,111}]}]}}

=INFO REPORT==== 1-Nov-2015::15:17:19 ===
{error,error,
    {case_clause,{secure,false}},
    [{cow_cookie,setcookie,3,[{file,"src/cow_cookie.erl"},{line,198}]},
     {cowboy_req,set_resp_cookie,4,[{file,"src/cowboy_req.erl"},{line,755}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
     {cowboy_simple_bridge,send,5,
         [{file,"src/cowboy_bridge_modules/cowboy_simple_bridge.erl"},
          {line,226}]},
     {cowboy_simple_bridge,build_response,2,
         [{file,"src/cowboy_bridge_modules/cowboy_simple_bridge.erl"},
          {line,175}]},
     {wf_core,run_crash,4,[{file,"src/wf_core.erl"},{line,46}]},
     {cowboy_simple_bridge_anchor,handle,2,
         [{file,"src/cowboy_bridge_modules/cowboy_simple_bridge_anchor.erl"},
          {line,34}]},
     {cowboy_handler,handler_handle,4,
         [{file,"src/cowboy_handler.erl"},{line,111}]}]}


I've tried on mac and centos with otp 17.x and otp 18.x on centos and still get error.

-wes

Jesse Gumm

unread,
Nov 1, 2015, 6:32:04 PM11/1/15
to nitrogenweb

Of course!

I just merged a new secure cookies feature into simple_bridge and sloppily forgot to make sure it works with Nitrogen. I've reverted the merge for now until I figure out what's going on.

Sorry about that! It should work now.

-Jesse

--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

Wes James

unread,
Nov 1, 2015, 8:03:42 PM11/1/15
to nitro...@googlegroups.com
OK.  Thanks :)

Wes James

unread,
Nov 1, 2015, 8:07:52 PM11/1/15
to nitro...@googlegroups.com
That worked :)  Thanks for your help with this :))))

-wes
Reply all
Reply to author
Forward
0 new messages