CatalystCode / project-fortis-pipeline

Project Fortis is a data ingestion, analysis and visualization pipeline.
Apache License 2.0
14 stars 9 forks source link

Admin page does not load after deployment #233

Closed c-w closed 6 years ago

c-w commented 6 years ago

After a successful deployment:

image

The admin page gives an error:

image

The error is thrown here:

image

Error response:

{
  "errors": [
    {
      "message": "Variable \"$bbox\" of required type \"[Float]!\" was not provided.",
      "locations": [
        {
          "line": 11,
          "column": 43
        }
      ]
    }
  ]
}

This happens after an earlier request to the settings endpoint that returned:

{
  "data": {
    "terms": {
      "edges": []
    },
    "streams": {
      "streams": []
    },
    "configuration": {
      "site": {
        "name": "clewolfffortis67b2",
        "properties": {
          "targetBbox": null,
          "defaultZoomLevel": 8,
          "logo": "",
          "title": "",
          "fbToken": null,
          "mapzenApiKey": null,
          "defaultLocation": null,
          "defaultLanguage": null,
          "featureservicenamespace": null,
          "storageConnectionString": null,
          "featuresConnectionString": null,
          "supportedLanguages": [
            "en"
          ]
        }
      }
    }
  }
}
c-w commented 6 years ago

Hypothesis:

Setting bbox to a default dummy value like [0,0,0,0] will fix the issue while doing no harm since the user is required to configure their bounding box of interest anyways after the deployment.

Evidence:

image

c-w commented 6 years ago

Further evidence:

After this change:

diff --git a/src/actions/Dashboard/index.js b/src/actions/Dashboard/index.js
index 34b8451..75cb36a 100644
--- a/src/actions/Dashboard/index.js
+++ b/src/actions/Dashboard/index.js
@@ -27,6 +27,8 @@ function fetchCommonTerms(settings, callback, timespanType, fromDate, toDate, ca
     configuration = configuration && configuration.site && configuration.site.properties;
     const dataSources = toDataSources((streams && streams.streams) || []);

+    if (!configuration.targetBbox) configuration.targetBbox = [0, 0, 0, 0];
+
     DashboardServices.getCommonTerms(timespanType, fromDate, toDate, configuration.targetBbox, configuration.defaultZoomLevel, category,
       (error, response, body) => ResponseHandler(error, response, body, (err, topics) => {
           if (!err) {

The admin page now loads:

image

c-w commented 6 years ago

Fix worked and was deployed succesfuly via ARM:

image