9 Replies Latest reply on Jul 4, 2012 9:17 PM by DANIEL PARK

    500 Internal Server Error

    DANIEL PARK

      Team,

      I am creating the standard RhoConnect app as seen in the tutorial and can query, edit & delete records on http://rhostore.heroku.com/products however, for some reason, when I create a record, and hit sync in the RhoEmulator, the new entry disappears and I can see that http://rhostore.heroku.com/products is also not updated. In the Rhoconnect log I can see the following:

       

      SourceAdapter raised create exception: 500 Internal Server Error

       

       

      The create code is just from the tutorial:

       

      res = RestClient.post(@base,:product => create_hash)

                  # After create we are redirected to the new record.

              # We need to get the id of that record and return

              # it as part of create so rhoconnect can establish a link

              # from its temporary object on the client to this newly

              # created object on the server

             JSON.parse(

                RestClient.get("#{res.headers[:location]}.json").body

              )["product"]["id"]

       

      Any ideas?

      Daniel

          • Re: 500 Internal Server Error
            DANIEL PARK

            Thanks for the response.

            I am wondering if it is a firewall or proxy setting?

             

            When i attempt the creat in the moto office I get the following message:

             

            [01:50:06 PM 2012-07-03] SourceAdapter raised query exception: getaddrinfo: The

            requested name is valid, but no data of the requested type was found.

             

            So my query is what firewall settings need to be changed on Windows 7 for Rhoconnect and where is the proxy setting set?

            regards,

            Daniel

                • Re: 500 Internal Server Error
                  DANIEL PARK

                  Thanks for the reply Rob.

                   

                  I may have confused things with my previous post. The issue I am trying to solve is the "500 Internal Server Error" issue. (the getaddrinfo error is likely due to proxy, I agree)

                   

                  I dont believe that this is a proxy issue as:

                   

                  1. I am able to update, delete and query (only create doesnt seem to work)

                  2. I have the issue when I am at home and not using the proxy.

                   

                  Is there any other way I could trouble shoot this issue (ie using IRB etc)?

                  regards,

                  Dan

                    • Re: 500 Internal Server Error

                      Try to use puts in the create code and see what is going. Also, you can catch all the exceptions and analyze them:

                       

                      def create(create_hash)

                           begin

                               res = RestClient.post(@base,:product => create_hash)    

                          resque Exception => e

                                log e.message + e.backtrace.join("\n")

                               raise e

                          end

                       

                          log "create succeeded!, now get the ID"

                          # After create we are redirected to the new record.

                          # We need to get the id of that record and return

                          # it as part of create so rhoconnect can establish a link

                          # from its temporary object on the client to this newly

                          # created object on the server

                          created_id = nil

                         begin

                            body = RestClient.get("#{res.headers[:location]}.json").body

                             created_id = JSON.parse(body)["product"]["id"]

                             puts " created ID is #{created_id} "

                          rescue Exception => e

                             log e.message + e.backtrace.join("\n")

                             raise e

                         end

                       

                        created_id

                      end


                        • Re: 500 Internal Server Error
                          DANIEL PARK

                          Thanks mzverev,

                          this looks like the way to go. However I am new to the world of debugging. Where do I look for these log entries? Do I need to run in a certain mode etc?

                          regards,

                          Daniel

                            • Re: 500 Internal Server Error
                              DANIEL PARK

                              In the mean time I did a test using IRB, where I manually assigned create_hash to some value:

                              create_hash = {'name' => 'Test Object', 'brand' => 'Test Brand', 'price' => '499.99', 'quantity' => '10'}


                              and ran through similar code from the create method.

                               

                              This actually worked. Its just not working in my Rhoconnect app.

                              Dan

                                • Re: 500 Internal Server Error
                                  DANIEL PARK

                                  Below is the out put I am getting from Rhoconnect. (see error in bold)

                                   

                                  Starting rhoconnect...

                                  [12:04:05 PM 2012-07-04] Rhoconnect Server v3.2.0 started...

                                  >> Thin web server (v1.3.1 codename Triple Espresso)

                                  >> Maximum connections set to 1024

                                  >> Listening on 0.0.0.0:9292, CTRL+C to stop

                                  127.0.0.1 - - [04/Jul/2012 12:04:34] "GET /api/application?client_id=1205d94904f

                                  14813b6a765d5907182b8&p_size=2000&version=3&source_name=Product HTTP/1.1" 401 17

                                  0.0000

                                  127.0.0.1 - - [04/Jul/2012 12:04:43] "POST /api/application/clientlogin HTTP/1.1

                                  " 200 300 0.0156

                                  127.0.0.1 - - [04/Jul/2012 12:04:43] "POST /api/application/clientregister HTTP/

                                  1.1" 200 - 0.0156

                                  [12:04:43 PM 2012-07-04] Use of the GET /api/application is deprecated. Use GET

                                  /api/application/query instead.

                                  127.0.0.1 - - [04/Jul/2012 12:04:43] "GET /api/application?client_id=1205d94904f

                                  14813b6a765d5907182b8&p_size=2000&version=3&source_name=Product HTTP/1.1" 200 18

                                  59 0.6280

                                  [12:04:43 PM 2012-07-04] Use of the GET /api/application is deprecated. Use GET

                                  /api/application/query instead.

                                  127.0.0.1 - - [04/Jul/2012 12:04:43] "GET /api/application?client_id=1205d94904f

                                  14813b6a765d5907182b8&p_size=2000&version=3&source_name=Product&token=1106390836

                                  85305 HTTP/1.1" 200 84 0.0156

                                  [12:05:06 PM 2012-07-04] Use of the POST /api/application is deprecated. Use POS

                                  T /api/application/queue_updates instead.

                                  [12:05:07 PM 2012-07-04] SourceAdapter raised create exception: 500 Internal Ser

                                  ver Error

                                  [12:05:07 PM 2012-07-04] C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1

                                  /gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/l

                                  ib/restclient/request.rb:230:in `process_result'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/l

                                  ib/restclient/request.rb:178:in `block in transmit'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/1.9.1/net/http.rb:745:in `start'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/l

                                  ib/restclient/request.rb:172:in `transmit'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/l

                                  ib/restclient/request.rb:64:in `execute'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/l

                                  ib/restclient/request.rb:33:in `execute'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rest-client-1.6.7/l

                                  ib/restclient.rb:72:in `post'

                                  C:/Users/tmb378/workspace/TestSync1/sources/product.rb:21:in `create'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:207:in `_process_create'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:286:in `block (2 levels) in _process_cud'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:263:in `each'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:263:in `block in _process_cud'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:259:in `each'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:259:in `each_with_index'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:259:in `_process_cud'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:243:in `block in _measure_and_process_cud'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/stats/record.rb:54:in `update'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:242:in `_measure_and_process_cud'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:14:in `create'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:77:in `do_cud'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/source_sync.rb:71:in `process_cud'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/client_sync.rb:28:in `receive_cud'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/api/application/queue_updates.rb:17:in `block (2 levels) in <top (r

                                  equired)>'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/async.rb:41:in `block in catch_all'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/async.rb:41:in `catch'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/async.rb:41:in `catch_all'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/api/application/queue_updates.rb:16:in `block in <top (required)>'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/async.rb:56:in `block (2 levels) in execute_api_call'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/async.rb:41:in `block in catch_all'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/async.rb:41:in `catch'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/async.rb:41:in `catch_all'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/rhoconnect-3.2.0/li

                                  b/rhoconnect/async.rb:55:in `block in execute_api_call'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.

                                  rc.4-x86-mingw32/lib/eventmachine.rb:1037:in `call'

                                  C:/MotorolaRhoMobileSuite2.0.5/ruby/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.

                                  rc.4-x86-mingw32/lib/eventmachine.rb:1037:in `block in spawn_threadpool'

                                  127.0.0.1 - - [04/Jul/2012 12:05:07] "POST /api/application HTTP/1.1" 200 - 1.03

                                  36

                                  [12:05:08 PM 2012-07-04] Use of the GET /api/application is deprecated. Use GET

                                  /api/application/query instead.

                                  127.0.0.1 - - [04/Jul/2012 12:05:08] "GET /api/application?client_id=1205d94904f

                                  14813b6a765d5907182b8&p_size=2000&version=3&source_name=Product HTTP/1.1" 200 25

                                  9 0.0156