ESRI JS API 4.9+ and Koop: services fail to load due to reduntant url params

178 Views Asked by At

JS API affected: 4.9, 4.10 JS API ok: < 4.8

after upgrading our application to 4.9, feature layers that are served from Koop server are not being loaded. I've tracked it down to the request that is querying for the feature count.

Let's consider the sample Koop service on the koop website

let koopServiceUrl = 'http://koop.dc.esri.com/github/smartchicago/chicago-atlas/db::import::zipcodes/FeatureServer/0'

Now the log in the chrome developers window will show 2 requests. - one for he layer defition which works ok (200) - one for the feature count, which returns 404 (see below)

enter image description here

Please note that the failing request has duplicate layer index value in url . If I remove the /0 from the defining url in koopServiceUrl, the layer loads fine. In version 4.8, the above service works normally and the request for the feature count is properly formatted with only a single layer index value in the url params.

1

There are 1 best solutions below

0
On

It looks like JS API > 4.8 needs to have the rest/services in the feature layer URL. The most recent versions of Koop include an additional set of routes that include this additional URL fragment. For example:

For example, the route:

/file-geojson/:id/FeatureServer/:layer/:method

has a functionally equivalent version with rest/services:

/file-geojson/rest/services/:id/FeatureServer/:layer/:method

If you use this second route, the JS API will work as expected.