humlab-sead / sead_query_api

.NET Core port of Query SEAD API
Other
2 stars 0 forks source link

Internal server error (500) on load of MS facet #29

Closed johanvonboer closed 5 years ago

johanvonboer commented 5 years ago

Command fetch("https://seadserv.humlab.umu.se:8089/api/facets/load" fails:

Header

{
"credentials":"omit",
"headers": {
"accept":"application/json, text/javascript, */*; q=0.01",
"content-type":"application/json; charset=UTF-8",
"sec-fetch-mode":"cors"
},
"referrer":"http://localhost:8080/",
"referrerPolicy":"no-referrer-when-downgrade",
"body":  "see-json-payload-below",
"method":"POST",
"mode":"cors"
};

Payload (body)

{
"requestId":1,
"requestType":"populate",
"targetCode":"tbl_denormalized_measured_values_33_0",
"facetConfigs":[ {
    "facetCode":"tbl_denormalized_measured_values_33_0",
    "position":1,
    "picks":[],
    "textFilter":""
}]
}
roger-mahler commented 5 years ago

Using REST Client:

POST https://seadserv.humlab.umu.se:8089/api/facets/load
content-type: application/json
mode: cors
accept: application/json

{
    "requestId":1,
    "requestType":"populate",
    "targetCode":"tbl_denormalized_measured_values_33_0",
    "facetConfigs":[ {
        "facetCode":"tbl_denormalized_measured_values_33_0",
        "position":1,
        "picks":[],
        "textFilter":""
    }
]

Returns:

HTTP/1.1 500 Internal Server Error
Server: nginx/1.14.2
Date: Mon, 21 Oct 2019 13:28:06 GMT
Content-Length: 0
Connection: close

Error log:

TRACE Opened connection to seadserv.humlab.umu.se:5432
DEBUG [10059] Connection opened
TRACE [10059] Start user action
DEBUG [10059] Executing statement(s):
        SELECT x.facet_id, x.aggregate_facet_id, x.aggregate_title, x.aggregate_type, x.category_id_expr, x.category_name_expr, x.display_title, x.facet_code, x.facet_group_id, x.facet_type_id, x.icon_id_expr, x.is_applicable, x.is_default, x.sort_expr, "x.FacetType".facet_type_id, "x.FacetType".facet_type_name, "x.FacetType".reload_as_target, "x.FacetGroup".facet_group_id, "x.FacetGroup".display_title, "x.FacetGroup".facet_group_key, "x.FacetGroup".is_applicable, "x.FacetGroup".is_default
FROM facet.facet AS x
INNER JOIN facet.facet_type AS "x.FacetType" ON x.facet_type_id = "x.FacetType".facet_type_id
INNER JOIN facet.facet_group AS "x.FacetGroup" ON x.facet_group_id = "x.FacetGroup".facet_group_id
ORDER BY x.facet_id
TRACE [10059] Cleaning up reader
TRACE [10059] End user action
TRACE [10059] Start user action
DEBUG [10059] Executing statement(s):
        SELECT "x.Tables".facet_table_id, "x.Tables".alias, "x.Tables".facet_id, "x.Tables".udf_call_arguments, "x.Tables".table_or_udf_name, "x.Tables".schema_name, "x.Tables".sequence_id
FROM facet.facet_table AS "x.Tables"
INNER JOIN (
    SELECT DISTINCT x0.facet_id
    FROM facet.facet AS x0
    INNER JOIN facet.facet_type AS "x.FacetType0" ON x0.facet_type_id = "x.FacetType0".facet_type_id
    INNER JOIN facet.facet_group AS "x.FacetGroup0" ON x0.facet_group_id = "x.FacetGroup0".facet_group_id
) AS t ON "x.Tables".facet_id = t.facet_id
ORDER BY t.facet_id
TRACE [10059] Cleaning up reader
TRACE [10059] End user action
TRACE [10059] Start user action
DEBUG [10059] Executing statement(s):
        SELECT "x.Clauses".facet_source_table_id, "x.Clauses".clause, "x.Clauses".facet_id
FROM facet.facet_clause AS "x.Clauses"
INNER JOIN (
    SELECT DISTINCT x1.facet_id
    FROM facet.facet AS x1
    INNER JOIN facet.facet_type AS "x.FacetType1" ON x1.facet_type_id = "x.FacetType1".facet_type_id
    INNER JOIN facet.facet_group AS "x.FacetGroup1" ON x1.facet_group_id = "x.FacetGroup1".facet_group_id
) AS t0 ON "x.Clauses".facet_id = t0.facet_id
ORDER BY t0.facet_id
TRACE [10059] Cleaning up reader
TRACE [10059] End user action
TRACE [10059] Closing connection...
TRACE [10059] Closing connector
TRACE [10059] Cleaning up connector
DEBUG [10059] Connection closed
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[1]
      Executing action method SeadQueryAPI.Controllers.FacetsController.Load (sead.query.api) with arguments () - Validation state: Invalid
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
      Executed action SeadQueryAPI.Controllers.FacetsController.Load (sead.query.api) in 39.1249ms
fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HLQJTSBM2KFC", Request id "0HLQJTSBM2KFC:00000001": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
   at SeadQueryAPI.Serializers.FacetConfigReconstituteService.Reconstitute(FacetsConfig2 facetsConfig) in /src/sead.query.api/Serializers/FacetConfigReconstituteService.cs:line 39
   at SeadQueryAPI.Controllers.FacetsController.Load(FacetsConfig2 facetsConfig) in /src/sead.query.api/Controllers/FacetsController.cs:line 79
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 41.3173ms 500