zooniverse / panoptes

Zooniverse API to support user defined volunteer research projects
Apache License 2.0
103 stars 41 forks source link

Adding subjects returns error, but does the job #491

Closed alianos- closed 9 years ago

alianos- commented 9 years ago

So I am trying to add subjects. I use "text/plain" because really we only store coordinates and we will retrieve the images from a WMS server. (Btw I am storing the coordinates in the metadata, any better ideas?)

I get the following error in the response, but then when I list subjects they have been are added like nothing happened.

AWS::Errors::MissingCredentialsError in Api::V1::SubjectsController#create

(in detail)

{
    "readyState": 4,
    "responseText": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"utf-8\" />\n  <title>Action Controller: Exception caught</title>\n  <style>\n    body {\n      background-color: #FAFAFA;\n      color: #333;\n      margin: 0px;\n    }\n\n    body, p, ol, ul, td {\n      font-family: helvetica, verdana, arial, sans-serif;\n      font-size:   13px;\n      line-height: 18px;\n    }\n\n    pre {\n      font-size: 11px;\n      white-space: pre-wrap;\n    }\n\n    pre.box {\n      border: 1px solid #EEE;\n      padding: 10px;\n      margin: 0px;\n      width: 958px;\n    }\n\n    header {\n      color: #F0F0F0;\n      background: #C52F24;\n      padding: 0.5em 1.5em;\n    }\n\n    h1 {\n      margin: 0.2em 0;\n      line-height: 1.1em;\n      font-size: 2em;\n    }\n\n    h2 {\n      color: #C52F24;\n      line-height: 25px;\n    }\n\n    .details {\n      border: 1px solid #D0D0D0;\n      border-radius: 4px;\n      margin: 1em 0px;\n      display: block;\n      width: 978px;\n    }\n\n    .summary {\n      padding: 8px 15px;\n      border-bottom: 1px solid #D0D0D0;\n      display: block;\n    }\n\n    .details pre {\n      margin: 5px;\n      border: none;\n    }\n\n    #container {\n      box-sizing: border-box;\n      width: 100%;\n      padding: 0 1.5em;\n    }\n\n    .source * {\n      margin: 0px;\n      padding: 0px;\n    }\n\n    .source {\n      border: 1px solid #D9D9D9;\n      background: #ECECEC;\n      width: 978px;\n    }\n\n    .source pre {\n      padding: 10px 0px;\n      border: none;\n    }\n\n    .source .data {\n      font-size: 80%;\n      overflow: auto;\n      background-color: #FFF;\n    }\n\n    .info {\n      padding: 0.5em;\n    }\n\n    .source .data .line_numbers {\n      background-color: #ECECEC;\n      color: #AAA;\n      padding: 1em .5em;\n      border-right: 1px solid #DDD;\n      text-align: right;\n    }\n\n    .line {\n      padding-left: 10px;\n    }\n\n    .line:hover {\n      background-color: #F6F6F6;\n    }\n\n    .line.active {\n      background-color: #FFCCCC;\n    }\n\n    a { color: #980905; }\n    a:visited { color: #666; }\n    a:hover { color: #C52F24; }\n\n    \n  </style>\n\n  <script>\n    var toggle = function(id) {\n      var s = document.getElementById(id).style;\n      s.display = s.display == 'none' ? 'block' : 'none';\n      return false;\n    }\n    var show = function(id) {\n      document.getElementById(id).style.display = 'block';\n    }\n    var hide = function(id) {\n      document.getElementById(id).style.display = 'none';\n    }\n    var toggleTrace = function() {\n      return toggle('blame_trace');\n    }\n    var toggleSessionDump = function() {\n      return toggle('session_dump');\n    }\n    var toggleEnvDump = function() {\n      return toggle('env_dump');\n    }\n  </script>\n</head>\n<body>\n\n<header>\n  <h1>\n    AWS::Errors::MissingCredentialsError\n      in Api::V1::SubjectsController#create\n  </h1>\n</header>\n\n<div id=\"container\">\n  <h2>\nMissing Credentials.\n\nUnable to find AWS credentials.  You can configure your AWS credentials\na few different ways:\n\n* Call AWS.config with :access_key_id and :secret_access_key\n\n* Export AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to ENV\n\n* On EC2 you can run instances with an IAM instance profile and credentials\n  will be auto loaded from the instance metadata service on those\n  instances.\n\n* Call AWS.config with :credential_provider.  A credential provider should\n  either include AWS::Core::CredentialProviders::Provider or respond to\n  the same public methods.\n\n= Ruby on Rails\n\nIn a Ruby on Rails application you may also specify your credentials in\nthe following ways:\n\n* Via a config initializer script using any of the methods mentioned above\n  (e.g. RAILS_ROOT/config/initializers/aws-sdk.rb).\n\n* Via a yaml configuration file located at RAILS_ROOT/config/aws.yml.\n  This file should be formated like the default RAILS_ROOT/config/database.yml\n  file.\n\n</h2>\n\n  <div class=\"source\">\n<div class=\"info\">\n  Extracted source (around line <strong>#46</strong>):\n</div>\n<div class=\"data\">\n  <table cellpadding=\"0\" cellspacing=\"0\" class=\"lines\">\n      <tr>\n        <td>\n          <pre class=\"line_numbers\">\n<span>44</span>\n<span>45</span>\n<span>46</span>\n<span>47</span>\n<span>48</span>\n<span>49</span>\n          </pre>\n        </td>\n<td width=\"100%\">\n<pre>\n<div class=\"line\">    if @context[:post_urls]\n</div><div class=\"line\">      obj = ::Panoptes.subjects_bucket.objects[path]\n</div><div class=\"line active\">      obj.url_for(:write, {secure: true,\n</div><div class=\"line\">                           content_type: mime_type,\n</div><div class=\"line\">                           expires_in: 20.minutes.from_now,\n</div><div class=\"line\">                           response_content_type: mime_type,\n</div>\n</pre>\n</td>\n    </tr>\n  </table>\n</div>\n</div>\n\n  \n<p><code>Rails.root: /rails_app</code></p>\n\n<div id=\"traces\">\n    <a href=\"#\" onclick=\"hide('Framework-Trace');hide('Full-Trace');show('Application-Trace');; return false;\">Application Trace</a> |\n    <a href=\"#\" onclick=\"hide('Application-Trace');hide('Full-Trace');show('Framework-Trace');; return false;\">Framework Trace</a> |\n    <a href=\"#\" onclick=\"hide('Application-Trace');hide('Framework-Trace');show('Full-Trace');; return false;\">Full Trace</a> \n\n    <div id=\"Application-Trace\" style=\"display: block;\">\n      <pre><code>lib/subject_locations_extractor.rb:46:in `s3_url'\nlib/subject_locations_extractor.rb:37:in `panoptes_locations'\nlib/subject_locations_extractor.rb:36:in `panoptes_locations'\nlib/subject_locations_extractor.rb:35:in `panoptes_locations'\nlib/subject_locations_extractor.rb:16:in `locations'\napp/serializers/subject_serializer.rb:8:in `locations'\nlib/json_api_controller/creatable_resource.rb:43:in `create_response'\napp/controllers/concerns/json_api_responses.rb:5:in `created_resource_response'\nlib/json_api_controller/creatable_resource.rb:16:in `create'\napp/middleware/catch_api_json_parse_errors.rb:8:in `call'\napp/middleware/reject_patch_requests.rb:8:in `call'</code></pre>\n    </div>\n    <div id=\"Framework-Trace\" style=\"display: none;\">\n      <pre><code>aws-sdk-v1 (1.61.0) lib/aws/core/credential_providers.rb:140:in `credentials'\naws-sdk-v1 (1.61.0) lib/aws/core/credential_providers.rb:62:in `access_key_id'\naws-sdk-v1 (1.61.0) lib/aws/s3/s3_object.rb:1322:in `presign_v3'\naws-sdk-v1 (1.61.0) lib/aws/s3/s3_object.rb:1260:in `url_for'\norg/jruby/RubyHash.java:1341:in `each'\norg/jruby/RubyEnumerable.java:865:in `inject'\norg/jruby/RubyArray.java:2412:in `map'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable.rb:46:in `as_json'\norg/jruby/RubyHash.java:1341:in `each'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable.rb:45:in `as_json'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable.rb:120:in `as_json'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable/paging.rb:39:in `serialize_page'\norg/jruby/RubyArray.java:2412:in `map'\nactiverecord (4.1.9) lib/active_record/relation/delegation.rb:46:in `map'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable/paging.rb:39:in `serialize_page'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable/paging.rb:14:in `page_with_options'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable/resource.rb:6:in `resource'\nactionpack (4.1.9) lib/action_controller/metal/implicit_render.rb:4:in `send_action'\nactionpack (4.1.9) lib/abstract_controller/base.rb:189:in `process_action'\nactionpack (4.1.9) lib/action_controller/metal/rendering.rb:10:in `process_action'\nactionpack (4.1.9) lib/abstract_controller/callbacks.rb:20:in `process_action'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:113:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:229:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:166:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:166:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:166:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:166:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:86:in `run_callbacks'\nactionpack (4.1.9) lib/abstract_controller/callbacks.rb:19:in `process_action'\nactionpack (4.1.9) lib/action_controller/metal/rescue.rb:29:in `process_action'\nactionpack (4.1.9) lib/action_controller/metal/instrumentation.rb:31:in `process_action'\nactivesupport (4.1.9) lib/active_support/notifications.rb:159:in `instrument'\nactivesupport (4.1.9) lib/active_support/notifications/instrumenter.rb:20:in `instrument'\nactivesupport (4.1.9) lib/active_support/notifications/instrumenter.rb:19:in `instrument'\nactivesupport (4.1.9) lib/active_support/notifications.rb:159:in `instrument'\nactionpack (4.1.9) lib/action_controller/metal/instrumentation.rb:30:in `process_action'\nactionpack (4.1.9) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'\nactiverecord (4.1.9) lib/active_record/railties/controller_runtime.rb:18:in `process_action'\nactionpack (4.1.9) lib/abstract_controller/base.rb:136:in `process'\nactionview (4.1.9) lib/action_view/rendering.rb:30:in `process'\nactionpack (4.1.9) lib/action_controller/metal.rb:196:in `dispatch'\nactionpack (4.1.9) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'\nactionpack (4.1.9) lib/action_controller/metal.rb:232:in `action'\norg/jruby/RubyProc.java:271:in `call'\nactionpack (4.1.9) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'\nactionpack (4.1.9) lib/action_dispatch/routing/route_set.rb:50:in `call'\nactionpack (4.1.9) lib/action_dispatch/routing/mapper.rb:45:in `call'\nactionpack (4.1.9) lib/action_dispatch/journey/router.rb:73:in `call'\norg/jruby/RubyArray.java:1613:in `each'\nactionpack (4.1.9) lib/action_dispatch/journey/router.rb:59:in `call'\nactionpack (4.1.9) lib/action_dispatch/routing/route_set.rb:685:in `call'\nomniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'\nomniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'\nomniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'\nomniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'\nversionist (1.4.0) lib/versionist/middleware.rb:39:in `_call'\nversionist (1.4.0) lib/versionist/middleware.rb:17:in `call'\nwarden (1.2.3) lib/warden/manager.rb:35:in `call'\norg/jruby/RubyKernel.java:1270:in `catch'\nwarden (1.2.3) lib/warden/manager.rb:34:in `call'\nrack (1.5.2) lib/rack/etag.rb:23:in `call'\nrack (1.5.2) lib/rack/conditionalget.rb:35:in `call'\nrack (1.5.2) lib/rack/head.rb:11:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/params_parser.rb:27:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/flash.rb:254:in `call'\nrack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'\nrack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/cookies.rb:562:in `call'\nactiverecord (4.1.9) lib/active_record/query_cache.rb:36:in `call'\nactiverecord (4.1.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'\nactiverecord (4.1.9) lib/active_record/migration.rb:380:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/callbacks.rb:29:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:82:in `run_callbacks'\nactionpack (4.1.9) lib/action_dispatch/middleware/callbacks.rb:27:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/reloader.rb:73:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'\nrailties (4.1.9) lib/rails/rack/logger.rb:38:in `call_app'\nrailties (4.1.9) lib/rails/rack/logger.rb:20:in `call'\nactivesupport (4.1.9) lib/active_support/tagged_logging.rb:68:in `tagged'\nactivesupport (4.1.9) lib/active_support/tagged_logging.rb:26:in `tagged'\nactivesupport (4.1.9) lib/active_support/tagged_logging.rb:68:in `tagged'\nrailties (4.1.9) lib/rails/rack/logger.rb:20:in `call'\nrequest_store (1.1.0) lib/request_store/middleware.rb:8:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/request_id.rb:21:in `call'\nrack (1.5.2) lib/rack/methodoverride.rb:21:in `call'\nrack (1.5.2) lib/rack/runtime.rb:17:in `call'\nactivesupport (4.1.9) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'\nrack (1.5.2) lib/rack/lock.rb:17:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/static.rb:84:in `call'\nrack (1.5.2) lib/rack/sendfile.rb:112:in `call'\nrack-cors (0.3.1) lib/rack/cors.rb:72:in `call'\nhoneybadger (1.16.7) lib/honeybadger/rack/error_notifier.rb:43:in `call'\nhoneybadger (1.16.7) lib/honeybadger/rack/user_feedback.rb:24:in `call'\nhoneybadger (1.16.7) lib/honeybadger/rack/user_informer.rb:13:in `call'\nrailties (4.1.9) lib/rails/engine.rb:514:in `call'\nrailties (4.1.9) lib/rails/application.rb:144:in `call'\nrack (1.5.2) lib/rack/content_length.rb:14:in `call'\npuma-2.11.0 (java) lib/puma/server.rb:507:in `handle_request'\npuma-2.11.0 (java) lib/puma/server.rb:505:in `handle_request'\npuma-2.11.0 (java) lib/puma/server.rb:375:in `process_client'\npuma-2.11.0 (java) lib/puma/server.rb:371:in `process_client'\npuma-2.11.0 (java) lib/puma/server.rb:262:in `run'\norg/jruby/RubyProc.java:271:in `call'\npuma-2.11.0 (java) lib/puma/thread_pool.rb:104:in `spawn_thread'\norg/jruby/RubyProc.java:271:in `call'\nlogging (1.8.2) lib/logging/diagnostic_context.rb:323:in `create_with_logging_context'</code></pre>\n    </div>\n    <div id=\"Full-Trace\" style=\"display: none;\">\n      <pre><code>aws-sdk-v1 (1.61.0) lib/aws/core/credential_providers.rb:140:in `credentials'\naws-sdk-v1 (1.61.0) lib/aws/core/credential_providers.rb:62:in `access_key_id'\naws-sdk-v1 (1.61.0) lib/aws/s3/s3_object.rb:1322:in `presign_v3'\naws-sdk-v1 (1.61.0) lib/aws/s3/s3_object.rb:1260:in `url_for'\nlib/subject_locations_extractor.rb:46:in `s3_url'\nlib/subject_locations_extractor.rb:37:in `panoptes_locations'\norg/jruby/RubyHash.java:1341:in `each'\norg/jruby/RubyEnumerable.java:865:in `inject'\nlib/subject_locations_extractor.rb:36:in `panoptes_locations'\norg/jruby/RubyArray.java:2412:in `map'\nlib/subject_locations_extractor.rb:35:in `panoptes_locations'\nlib/subject_locations_extractor.rb:16:in `locations'\napp/serializers/subject_serializer.rb:8:in `locations'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable.rb:46:in `as_json'\norg/jruby/RubyHash.java:1341:in `each'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable.rb:45:in `as_json'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable.rb:120:in `as_json'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable/paging.rb:39:in `serialize_page'\norg/jruby/RubyArray.java:2412:in `map'\nactiverecord (4.1.9) lib/active_record/relation/delegation.rb:46:in `map'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable/paging.rb:39:in `serialize_page'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable/paging.rb:14:in `page_with_options'\n/usr/local/lib/ruby/gems/shared/bundlerrestpack_serializer (13f5d936c689) lib/restpack_serializer/serializable/resource.rb:6:in `resource'\nlib/json_api_controller/creatable_resource.rb:43:in `create_response'\napp/controllers/concerns/json_api_responses.rb:5:in `created_resource_response'\nlib/json_api_controller/creatable_resource.rb:16:in `create'\nactionpack (4.1.9) lib/action_controller/metal/implicit_render.rb:4:in `send_action'\nactionpack (4.1.9) lib/abstract_controller/base.rb:189:in `process_action'\nactionpack (4.1.9) lib/action_controller/metal/rendering.rb:10:in `process_action'\nactionpack (4.1.9) lib/abstract_controller/callbacks.rb:20:in `process_action'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:113:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:229:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:166:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:166:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:166:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:149:in `halting_and_conditional'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:166:in `halting'\norg/jruby/RubyProc.java:271:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:86:in `run_callbacks'\nactionpack (4.1.9) lib/abstract_controller/callbacks.rb:19:in `process_action'\nactionpack (4.1.9) lib/action_controller/metal/rescue.rb:29:in `process_action'\nactionpack (4.1.9) lib/action_controller/metal/instrumentation.rb:31:in `process_action'\nactivesupport (4.1.9) lib/active_support/notifications.rb:159:in `instrument'\nactivesupport (4.1.9) lib/active_support/notifications/instrumenter.rb:20:in `instrument'\nactivesupport (4.1.9) lib/active_support/notifications/instrumenter.rb:19:in `instrument'\nactivesupport (4.1.9) lib/active_support/notifications.rb:159:in `instrument'\nactionpack (4.1.9) lib/action_controller/metal/instrumentation.rb:30:in `process_action'\nactionpack (4.1.9) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'\nactiverecord (4.1.9) lib/active_record/railties/controller_runtime.rb:18:in `process_action'\nactionpack (4.1.9) lib/abstract_controller/base.rb:136:in `process'\nactionview (4.1.9) lib/action_view/rendering.rb:30:in `process'\nactionpack (4.1.9) lib/action_controller/metal.rb:196:in `dispatch'\nactionpack (4.1.9) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'\nactionpack (4.1.9) lib/action_controller/metal.rb:232:in `action'\norg/jruby/RubyProc.java:271:in `call'\nactionpack (4.1.9) lib/action_dispatch/routing/route_set.rb:82:in `dispatch'\nactionpack (4.1.9) lib/action_dispatch/routing/route_set.rb:50:in `call'\nactionpack (4.1.9) lib/action_dispatch/routing/mapper.rb:45:in `call'\nactionpack (4.1.9) lib/action_dispatch/journey/router.rb:73:in `call'\norg/jruby/RubyArray.java:1613:in `each'\nactionpack (4.1.9) lib/action_dispatch/journey/router.rb:59:in `call'\nactionpack (4.1.9) lib/action_dispatch/routing/route_set.rb:685:in `call'\nomniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'\nomniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'\nomniauth (1.2.2) lib/omniauth/strategy.rb:186:in `call!'\nomniauth (1.2.2) lib/omniauth/strategy.rb:164:in `call'\nversionist (1.4.0) lib/versionist/middleware.rb:39:in `_call'\nversionist (1.4.0) lib/versionist/middleware.rb:17:in `call'\nwarden (1.2.3) lib/warden/manager.rb:35:in `call'\norg/jruby/RubyKernel.java:1270:in `catch'\nwarden (1.2.3) lib/warden/manager.rb:34:in `call'\nrack (1.5.2) lib/rack/etag.rb:23:in `call'\nrack (1.5.2) lib/rack/conditionalget.rb:35:in `call'\nrack (1.5.2) lib/rack/head.rb:11:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/params_parser.rb:27:in `call'\napp/middleware/catch_api_json_parse_errors.rb:8:in `call'\napp/middleware/reject_patch_requests.rb:8:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/flash.rb:254:in `call'\nrack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'\nrack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/cookies.rb:562:in `call'\nactiverecord (4.1.9) lib/active_record/query_cache.rb:36:in `call'\nactiverecord (4.1.9) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in `call'\nactiverecord (4.1.9) lib/active_record/migration.rb:380:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/callbacks.rb:29:in `call'\nactivesupport (4.1.9) lib/active_support/callbacks.rb:82:in `run_callbacks'\nactionpack (4.1.9) lib/action_dispatch/middleware/callbacks.rb:27:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/reloader.rb:73:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'\nrailties (4.1.9) lib/rails/rack/logger.rb:38:in `call_app'\nrailties (4.1.9) lib/rails/rack/logger.rb:20:in `call'\nactivesupport (4.1.9) lib/active_support/tagged_logging.rb:68:in `tagged'\nactivesupport (4.1.9) lib/active_support/tagged_logging.rb:26:in `tagged'\nactivesupport (4.1.9) lib/active_support/tagged_logging.rb:68:in `tagged'\nrailties (4.1.9) lib/rails/rack/logger.rb:20:in `call'\nrequest_store (1.1.0) lib/request_store/middleware.rb:8:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/request_id.rb:21:in `call'\nrack (1.5.2) lib/rack/methodoverride.rb:21:in `call'\nrack (1.5.2) lib/rack/runtime.rb:17:in `call'\nactivesupport (4.1.9) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'\nrack (1.5.2) lib/rack/lock.rb:17:in `call'\nactionpack (4.1.9) lib/action_dispatch/middleware/static.rb:84:in `call'\nrack (1.5.2) lib/rack/sendfile.rb:112:in `call'\nrack-cors (0.3.1) lib/rack/cors.rb:72:in `call'\nhoneybadger (1.16.7) lib/honeybadger/rack/error_notifier.rb:43:in `call'\nhoneybadger (1.16.7) lib/honeybadger/rack/user_feedback.rb:24:in `call'\nhoneybadger (1.16.7) lib/honeybadger/rack/user_informer.rb:13:in `call'\nrailties (4.1.9) lib/rails/engine.rb:514:in `call'\nrailties (4.1.9) lib/rails/application.rb:144:in `call'\nrack (1.5.2) lib/rack/content_length.rb:14:in `call'\npuma-2.11.0 (java) lib/puma/server.rb:507:in `handle_request'\npuma-2.11.0 (java) lib/puma/server.rb:505:in `handle_request'\npuma-2.11.0 (java) lib/puma/server.rb:375:in `process_client'\npuma-2.11.0 (java) lib/puma/server.rb:371:in `process_client'\npuma-2.11.0 (java) lib/puma/server.rb:262:in `run'\norg/jruby/RubyProc.java:271:in `call'\npuma-2.11.0 (java) lib/puma/thread_pool.rb:104:in `spawn_thread'\norg/jruby/RubyProc.java:271:in `call'\nlogging (1.8.2) lib/logging/diagnostic_context.rb:323:in `create_with_logging_context'</code></pre>\n    </div>\n</div>\n\n  \n\n<h2 style=\"margin-top: 30px\">Request</h2>\n<p><b>Parameters</b>:</p> <pre>{"subjects"=>{"locations"=>["text/plain"],\n "metadata"=>{"coordinates"=>"{x : 11111,\n y:5555}"},\n "links"=>{"project"=>"1"}}}</pre>\n\n<div class=\"details\">\n  <div class=\"summary\"><a href=\"#\" onclick=\"return toggleSessionDump()\">Toggle session dump</a></div>\n  <div id=\"session_dump\" style=\"display:none\"><pre>_csrf_token: "q0KKG81n/fLn7r9tCmeJ++zkhCZ9t67a2MgI1bNUNEo="\ncellect_hosts: {""=>"172.17.0.7"}\nflash: {"discard"=>["notice"], "flashes"=>{"notice"=>"Signed out successfully."}}\nsession_id: "0b9a203393f5eb757c5a28c4d8242195"\nwarden.user.user.key: [[1], "$2a$10$u0OQBstArAtKCxKF9N6Vu."]</pre></div>\n</div>\n\n<div class=\"details\">\n  <div class=\"summary\"><a href=\"#\" onclick=\"return toggleEnvDump()\">Toggle env dump</a></div>\n  <div id=\"env_dump\" style=\"display:none\"><pre>GATEWAY_INTERFACE: "CGI/1.2"\nHTTP_ACCEPT: "application/vnd.api+json; version=1"\nHTTP_ACCEPT_ENCODING: "gzip, deflate, lzma"\nHTTP_ACCEPT_LANGUAGE: "en-US,en;q=0.8"\nREMOTE_ADDR: "192.168.1.80"\nSERVER_NAME: "192.168.1.102"\nSERVER_PROTOCOL: "HTTP/1.1"</pre></div>\n</div>\n\n<h2 style=\"margin-top: 30px\">Response</h2>\n<p><b>Headers</b>:</p> <pre>None</pre>\n\n</div>\n\n\n</body>\n</html>\n",
    "status": 500,
    "statusText": "Internal Server Error"
}
camallen commented 9 years ago

@alianos- so we store our subjects on s3 for distribution. Sounds like you have your own subject hosting service so you don't need to leverage this but those URL's will be stored in the subject locations. It sounds like your front end uses the metadata fields to link the coords and the image, e.g.

{   "subjects": [
    {
      "id": "1",
      "locations": [
        {
          "image/jpeg": "http://s3.amazonaws.com/subjects/1.png"
        }
      ],
      "metadata": {
        "file_location": "http://WMS_SERVER_URL/file_1.image_ext",
        "coords": [ 1, 1 ]
      },
    } ]
 }

If this is the case then it's up to your front end to understand the custom metadata hash URL format. To avoid this error you can just edit your aws.yml config for the development and the production env (if / when you run in production mode), make it look like the test env if you want but those values will propogate to your 'locations' object (but you'll ignore them anyway).

As our API is not at version 1 yet (it's getting there). We've got work planned to use different subject storage locations via #425. This will be by configurable and you should be able to specify location URL's if you've got them hosted elsewhere.

alianos- commented 9 years ago

Still what happens is inconsistent, since the server returns an error while the operation has in fact been successful. But I am assuming it will be resolved by the time you have the final version, so anyway.

Keep in mind that not all crowdsourcing projects will require external resources. For my PhD project we only had plain text multiple choice questions, so there was no need for any kind of location at all, and the same stand for this project (unless it would make sense to store plain text files with the coordinates and link to them? not sure).

Finally -having 0 understanding of what aws.yml does or how to configure it- I copied the values from the test to development and the error went away. For reference, here is what is inserted in both cases.

for reference my subjects look like that

{
            "id": "3",
            "metadata": {
                "coordinates": "{x : 2222, y: 555}"
            },
            "locations": [
                {
                    "text/plain": "https:///1/0/f119841a-3ff0-4d55-ac31-a3d14fff92b4.txt"
                }
            ],
          [...]
        }
          "id": "4",
            "metadata": {
                "coordinates": "{x : 2222, y: 555}"
            },
           "locations": [
                {
                    "text/plain": "https://s3.amazonaws.com/s3_subject_bucket/test_bucket_path/1/0/6293560e-f198-4975-bfea-1d5d189326cd.txt?AWSAccessKeyId=test_key_id&Expires=1422988220&Signature=eKEXZg5I4w60OZoNd5qp9Euw%2FqA%3D&response-content-type=text%2Fplain&x-amz-acl=public-read"
                }
            ],
[...]

PS. I am not closing the issue in case you want to add something, but feel free to close it.

camallen commented 9 years ago

So those subject locations you submitted are overwritten with the value from the AWS confg, see here. You can override the behaviour via aws.rb or just override build_resource_for(create|update) via here. Alternatively as i said before just store the location in the metadata. It'll get serialised as a response to the client and you can just ignore the locations array client side.

Also aws.yml configures the access keys and storage areas for aws s3.

We're currently building what we need as an open source project. Long term we will extract a core version of Panoptes with plugin features for this sort of thing. Feel free to add a PR to add a subject storage adapter for us ;).

alianos- commented 9 years ago

I still don't get you. I did not submit any location, and I don't need any location either, so why would I store an empty location it the metadata?

here is how my request looks

'subjects': {
                'locations': ['text/plain'],
                'metadata': {
                    'coordinates': '{x:111,y:222}'
                },
                'links': {
                    'project': '1'
                }
            }

I would not trust myself overriding anything as I am not familiar with Ruby, and it is not the right time to learn either I am afraid :( So long as the previous solution works I am fine with it, but what I meant is that maybe you'd like to make the location optional.

As for your last sentence, I don't know what is a PR, or a 'subject storage adapter', so I am probably not the right person to contribute, at least not at this stage :(

camallen commented 9 years ago

When you submit locations via the mime type they will create s3 links where you can then put/upload your subject files too. You aren't using this obviously but those locations to s3 are being created and stored on your subjects, see the second subject you referenced here.

Re why would you store an empty location in the metadata, when Panoptes serves subjects to be classified to the client, it includes a subject file location that the client uses to download and present to the user. How will you get the client to present and unknown subject location? erhaps your client is using our API differently to how we use it.

Ruby's not that hard (once you've used it) and you've got a fairly good grasp on the tech if you run the code in dev mode *(you are) then it's reloaded (i.e. changes appear instantly in the server) on each req and you can easily use git to revert changes, that's up to you though.

We have the work planned for the future but it's not on our radar just yet as this is how our infrastructure works. We're not trying to make a citizen science platform for every use case, just ours for the moment.

PR -> A git hub pull request for a subject storage adapter (http://en.wikipedia.org/wiki/Adapter_pattern).

camallen commented 9 years ago

Adding the aws credentials before startup fixes the error.

alianos- commented 9 years ago

Hi Camallen. Thanks for all the info, it all made much more sense with the latest post. I gave my input in regards with the second paragraph to #443