Data not loading - "an error occurred fetching data"

2307
3
Jump to solution
06-30-2019 09:34 PM
MalcolmJ
Occasional Contributor II

Hi

We have had our Hub/Open Data site running for several years using map services from 10.3.1

We now have an enterprise GIS server on 10.7 and are planning on shifting our map services to come from this server.

I have set up a test and its not working. The map service is configured on 10.7 in the same way as 10.3.1 but when I add the data to Open Data and go to the Data tab, I get "An error occurred fetching data"

This is the current map service and Open Data item coming from 10.3.1

https://data-marlborough.opendata.arcgis.com/datasets/alcohol-control-areas/data

https://maps.marlborough.govt.nz/arcgis/rest/services/OpenData/OpenData2/MapServer/11

This is the one coming from 10.7

https://data-marlborough.opendata.arcgis.com/datasets/alcohol-control-areas-2/data

https://gis.marlborough.govt.nz/server/rest/services/OpenData/OpenData2/MapServer/0

Any ideas why the 10.7 service isn't working?

The spatial record seems to be coming through ok as I can see the two polygons on the map, its just the Data tab thats not working correctly.

Thanks

0 Kudos
1 Solution

Accepted Solutions
DanielFenton1
Occasional Contributor III

Hi Malcolm,

The issue is that CORS is disabled on your service. If you open the JavaScript console on your browser you will see a message that looks like this:

Access to XMLHttpRequest at 'https://gis.marlborough.govt.nz/server/rest/services/OpenData/OpenData2/MapServer/0/query?f=json&where=1%3D1&outStatistics=[{%22statisticType%22:%22count%22,%22onStatisticField%22:%22OBJECTID%22,%22outStatisticFieldName%22:%22objectIdCount%22}]' from origin 'https://data-marlborough.opendata.arcgis.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

You’ll need to check your settings and ensure that your domain, data-marlborough.opendata.arcgis.com, is enabled.

These docs list how to control those settings: https://enterprise.arcgis.com/en/server/latest/administer/linux/restricting-cross-domain-requests-to-arcgis-server.htm

Let me know if this doesn’t help resolve your issue.

Daniel Fenton

View solution in original post

0 Kudos
3 Replies
DanielFenton1
Occasional Contributor III

Hi Malcolm,

The issue is that CORS is disabled on your service. If you open the JavaScript console on your browser you will see a message that looks like this:

Access to XMLHttpRequest at 'https://gis.marlborough.govt.nz/server/rest/services/OpenData/OpenData2/MapServer/0/query?f=json&where=1%3D1&outStatistics=[{%22statisticType%22:%22count%22,%22onStatisticField%22:%22OBJECTID%22,%22outStatisticFieldName%22:%22objectIdCount%22}]' from origin 'https://data-marlborough.opendata.arcgis.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource

You’ll need to check your settings and ensure that your domain, data-marlborough.opendata.arcgis.com, is enabled.

These docs list how to control those settings: https://enterprise.arcgis.com/en/server/latest/administer/linux/restricting-cross-domain-requests-to-arcgis-server.htm

Let me know if this doesn’t help resolve your issue.

Daniel Fenton

0 Kudos
MichaelVolz
Esteemed Contributor

Has the default setting for CORS changed between 10.3 and 10.7 where it was enabled by default for new services in 10.3, but in 10.7 it is disabled by default and needs to be enabled?

Here is a note from a link:

Use of the * wildcard character as a substitute for the machine name is not supported. You must specify the fully qualified domain name of the machine in the list.

Has this setting changed between 10.3 and 10.7 where in 10.3 (maybe other versions as well) the wildcard character was supported in the AllowedOrigins field?

0 Kudos
MalcolmJ
Occasional Contributor II

Hi Daniel

Thanks - thats worked. The data records now appear in the table.

I still am seeing errors in the developer console though when I go to the Data tab?

https://data-marlborough.opendata.arcgis.com/datasets/alcohol-licenses/data

Although the records appear to be loading ok and downloading without any issue

Thanks

0 Kudos