<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Proxied MapImageLayer fails to load Sublayer details in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proxied-mapimagelayer-fails-to-load-sublayer/m-p/1488794#M84829</link>
    <description>&lt;P&gt;Created a reproduction repository:&amp;nbsp;&lt;A href="https://github.com/sebastianfrey/arcgis-mapserver-proxy-issue" target="_blank"&gt;https://github.com/sebastianfrey/arcgis-mapserver-proxy-issue&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2024 09:13:25 GMT</pubDate>
    <dc:creator>SebastianFrey1</dc:creator>
    <dc:date>2024-06-11T09:13:25Z</dc:date>
    <item>
      <title>Proxied MapImageLayer fails to load Sublayer details</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proxied-mapimagelayer-fails-to-load-sublayer/m-p/1476819#M84680</link>
      <description>&lt;P&gt;I have a Single Page Application (SPA), which is accessible under&lt;/P&gt;&lt;P&gt;&lt;A href="http://localhost:8080/" target="_blank" rel="noopener"&gt;http://localhost:8080/&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition I have a MapServer hosted on a local arcgis server instance with the following URL&lt;/P&gt;&lt;P&gt;&lt;A href="http://localhost:6443/arcgis/rest/services/myservices/MapServer" target="_blank" rel="noopener"&gt;http://localhost:6443/arcgis/rest/services/myservice/MapServer&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Due to authentication in production, this MapServer must be proxied through my backend , which handles authentication against the ArcGIS server services. So the service is accessible through the following URL&lt;/P&gt;&lt;P&gt;&lt;A href="http://localhost:8080/proxy/myservices" target="_blank" rel="noopener"&gt;http://localhost:8080/proxy/myservice&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Now in that SPA, I create a MapImageLayer instance using the proxy URL:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import MapImageLayer from "@arcgis/core/layers/MapImageLayer.js";

const layer = new MapImageLayer({
  url: 'http://localhost:8080/proxy/myservice'
});
await layer.load();

const sublayer = layer.sublayers.at(0);
await sublayer.load();&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At first everything seems fine, because&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;assert(sublayer.loadStatus === 'loaded')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;does not fail, but members like fields, renderer or labeling info are not populated properly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I took a look at my browsers network log, which logs a 404 request to&lt;/P&gt;&lt;P&gt;&lt;A href="http://localhost:8080/layers?f=json" target="_blank" rel="noopener"&gt;http://localhost:8080/layers?f=json&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I assume that this request should fetch the Sublayer details, such as fields, renderer or labeling info. But instead of instantiating the request relative to the SPA's root, the Sublayer details should be fetched relative to the layer proxy URL:&lt;/P&gt;&lt;P&gt;&lt;A href="http://localhost:8080/proxy/myservices" target="_blank" rel="noopener"&gt;http://localhost:8080/proxy/myservice/layers?f=json&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this actually a bug in the SDK, or something I can fix on my side?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;---------------------------------------------------------------- 2024-06-20 - Edit&amp;nbsp;----------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: The proxy implementation is irrelevant here. The bug can be reproduced with any proxy.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2024 09:52:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proxied-mapimagelayer-fails-to-load-sublayer/m-p/1476819#M84680</guid>
      <dc:creator>SebastianFrey1</dc:creator>
      <dc:date>2024-06-20T09:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Proxied MapImageLayer fails to load Sublayer details</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proxied-mapimagelayer-fails-to-load-sublayer/m-p/1488794#M84829</link>
      <description>&lt;P&gt;Created a reproduction repository:&amp;nbsp;&lt;A href="https://github.com/sebastianfrey/arcgis-mapserver-proxy-issue" target="_blank"&gt;https://github.com/sebastianfrey/arcgis-mapserver-proxy-issue&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2024 09:13:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/proxied-mapimagelayer-fails-to-load-sublayer/m-p/1488794#M84829</guid>
      <dc:creator>SebastianFrey1</dc:creator>
      <dc:date>2024-06-11T09:13:25Z</dc:date>
    </item>
  </channel>
</rss>

