<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 24, 2015 at 4:57 PM, Gabor Szabo <span dir="ltr"><<a href="mailto:gabor@szabgab.com" target="_blank">gabor@szabgab.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5">On Thu, Sep 24, 2015 at 4:14 PM, Gabor Szabo <span dir="ltr"><<a href="mailto:gabor@szabgab.com" target="_blank">gabor@szabgab.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">While trying to deploy an application I've just encountered this error:<br><div><br>error @2015-09-24 09:06:31> Route exception: Undef did not pass type constraint "Str" (in $args->{"name"}) at (eval 663) line 192<br>    "Str" is a subtype of "Value"<br>    "Value" is a subtype of "Defined"<br>    Undef did not pass type constraint "Defined" (in $args->{"name"})<br>    "Defined" is defined as: (defined($_)) in /home/user/perl5.22.0/lib/site_perl/5.22.0/Dancer2/Core/App.pm l. 1276<br clear="all"><br></div><div>I don't see this on my development machine and so far I have no idea where to look.<br><br></div><div>Before I go down the rabbit hole trying to find the differences and the source of the problem,<br>I wonder if anyone has encountered this.<br><br></div><div>Dancer2 0.162   on both machines:<br></div><div>dev using plackup 1.0037<br></div><div>prod using Starman 0.4014<br><br>Dancer2::Plugin::Auth::Extensible 0.401<br><br></div><div>regards<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div>   Gabor</div></font></span></div></blockquote></div></div><div><br><br><div>I tried using plack on the server and it work properly. <br></div><div>It also seems to work well when I run<br><br>plackup -s Starman -p 3000<br></div><div><br>So it seems this is something related to how I run Starman which is by way of this script launched<br></div><div>from /etc/rc.local<br><br></div><div><br>#!/home/user/perl5.22.0/bin/perl<br>use warnings;<br>use strict;<br>use Daemon::Control;<br><br>use File::Basename qw(dirname);<br>use Cwd qw(abs_path);<br><br>Daemon::Control->new(<br>        {<br>                name      => 'Starman',<br>                lsb_start => '$syslog $remote_fs',<br>                lsb_stop  => '$syslog',<br>                lsb_sdesc => 'Starman Short',<br>                lsb_desc  => 'Starman controls the web sites.',<br>                path      => abs_path($0),<br><br>                program => dirname($^X) . '/starman',<br><br>                program_args => [ '--workers', '5', '--port', '3000', '/home/user/work/app/app.psgi' ],<br><br>                pid_file    => '/tmp/starman.pid',<br>                stderr_file => '/tmp/starman.err',<br>                stdout_file => '/tmp/starman.out',<br><br>                fork => 2,<br><br>        }<br>)->run;<br><br><br></div><div>Oh and I am using perl 5.22.<span class=""><font color="#888888"><br><br></font></span></div><span class=""><font color="#888888"><div><br></div>Gabor<br><br><br> </font></span></div></div></div></div>
</blockquote></div><br><br></div><div class="gmail_extra">OK I found the source of this error.<br></div><div class="gmail_extra">I have put the mongodb configuration parameters in the environment/development.yml which worked every time I used plack, but<br></div><div class="gmail_extra">when I launched Starman directly then it was using a differetn environment (deployment if I am not mistaken).<br><br></div><div class="gmail_extra">The solution was to add<br><br>$ENV{DANCER_ENVIRONMENT} = 'production';<br><br></div><div class="gmail_extra">to the code launching Starman<br><br></div><div class="gmail_extra">and add the appropriate mongodb configuration options to the environment/production.yml file.<br><br><br></div>Now I just wonder if Dancer could have provided me with a better error report?<br><br><div><div class="gmail_extra">Gabor<br><br></div></div></div>