<?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: Uncaught TypeError: Cannot read properties of null (reading 'insertBefore') in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1347085#M82724</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Workaround is to add empty script in head section &amp;lt;script&amp;gt;&amp;lt;/script&amp;gt; or any other script (if all of your scripts are in body).&lt;/STRONG&gt;&lt;BR /&gt;We have encountered similiar problem recently when we migrated our repo to webpack 5.&lt;BR /&gt;This piece of code takes first script in document, which has type != dojo:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var ya = x.getElementsByTagName("script");
for (d = 0; !Oa; )
   /^dojo/.test((e = ya[d++]) &amp;amp;&amp;amp; e.type) || (Oa = e);&lt;/LI-CODE&gt;&lt;P&gt;Then this script is used in injectUrl method to get parentNode and then insert esri scripts before it. In our case sometimes dynamic chunk script&amp;nbsp;(added temporarily to html document head) was selected. But since dynamic chunks are removed from DOM (parent node becomes undefined) code fails and throws error.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Nov 2023 12:21:38 GMT</pubDate>
    <dc:creator>mattheol</dc:creator>
    <dc:date>2023-11-08T12:21:38Z</dc:date>
    <item>
      <title>Uncaught TypeError: Cannot read properties of null (reading 'insertBefore')</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1115924#M75246</link>
      <description>&lt;P&gt;On hard refreshing page map is not visible. I am integrating ArcGIS in my angular project. And I am using&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;link&lt;/SPAN&gt; &lt;SPAN&gt;rel&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"stylesheet"&lt;/SPAN&gt; &lt;SPAN&gt;href&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;A href="https://js.arcgis.com/3.38/esri/css/esri.css" target="_blank" rel="noopener"&gt;https://js.arcgis.com/3.38/esri/css/esri.css&lt;/A&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;script&lt;/SPAN&gt;&amp;nbsp;&lt;SPAN&gt;src&lt;/SPAN&gt;&lt;SPAN&gt;=&lt;/SPAN&gt;&lt;SPAN&gt;"&lt;A href="https://js.arcgis.com/3.38/" target="_blank" rel="noopener"&gt;https://js.arcgis.com/3.38/&lt;/A&gt;"&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&amp;lt;/&lt;/SPAN&gt;&lt;SPAN&gt;script&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;It throws error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;core.js:6456 ERROR Error: Uncaught (in promise): TypeError: Cannot read properties of null (reading 'insertBefore')&lt;BR /&gt;TypeError: Cannot read properties of null (reading 'insertBefore')&lt;BR /&gt;at Function.d.injectUrl ((index):36)&lt;BR /&gt;at Sa ((index):33)&lt;BR /&gt;at a ((index):10)&lt;BR /&gt;at (index):20&lt;BR /&gt;at Na ((index):29)&lt;BR /&gt;at ua ((index):20)&lt;BR /&gt;at sa ((index):20)&lt;BR /&gt;at d ((index):11)&lt;BR /&gt;at esri-loader.js:233&lt;BR /&gt;at new ZoneAwarePromise (zone.js:1387)&lt;BR /&gt;at resolvePromise (zone.js:1213)&lt;BR /&gt;at resolvePromise (zone.js:1167)&lt;BR /&gt;at zone.js:1279&lt;BR /&gt;at ZoneDelegate.invokeTask (zone.js:406)&lt;BR /&gt;at Object.onInvokeTask (core.js:28654)&lt;BR /&gt;at ZoneDelegate.invokeTask (zone.js:405)&lt;BR /&gt;at Zone.runTask (zone.js:178)&lt;BR /&gt;at drainMicroTaskQueue (zone.js:582)&lt;BR /&gt;at invokeTask (zone.js:491)&lt;BR /&gt;at ZoneTask.invoke (zone.js:476)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/505008"&gt;@Sage&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 04:51:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1115924#M75246</guid>
      <dc:creator>KartikThakur</dc:creator>
      <dc:date>2021-11-11T04:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: Uncaught TypeError: Cannot read properties of null (reading 'insertBefore')</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1116045#M75257</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/511190"&gt;@KartikThakur&lt;/a&gt;&amp;nbsp;we suggest using Esri-loader to help load ArcGIS JS API 3.x in JavaScript frameworks:&amp;nbsp;&lt;A href="https://github.com/Esri/esri-loader/blob/master/README.md" target="_blank"&gt;https://github.com/Esri/esri-loader/blob/master/README.md&lt;/A&gt;. For best performance and the latest functionality, we recommend using 4.x latest and our ES modules build:&amp;nbsp;&lt;A href="https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-angular-cli#arcgis-api-for-javascript-with-angular-cli" target="_blank"&gt;https://github.com/Esri/jsapi-resources/tree/master/esm-samples/jsapi-angular-cli#arcgis-api-for-javascript-with-angular-cli&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Nov 2021 16:08:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1116045#M75257</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2021-11-11T16:08:34Z</dc:date>
    </item>
    <item>
      <title>Re: Uncaught TypeError: Cannot read properties of null (reading 'insertBefore')</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1347085#M82724</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Workaround is to add empty script in head section &amp;lt;script&amp;gt;&amp;lt;/script&amp;gt; or any other script (if all of your scripts are in body).&lt;/STRONG&gt;&lt;BR /&gt;We have encountered similiar problem recently when we migrated our repo to webpack 5.&lt;BR /&gt;This piece of code takes first script in document, which has type != dojo:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var ya = x.getElementsByTagName("script");
for (d = 0; !Oa; )
   /^dojo/.test((e = ya[d++]) &amp;amp;&amp;amp; e.type) || (Oa = e);&lt;/LI-CODE&gt;&lt;P&gt;Then this script is used in injectUrl method to get parentNode and then insert esri scripts before it. In our case sometimes dynamic chunk script&amp;nbsp;(added temporarily to html document head) was selected. But since dynamic chunks are removed from DOM (parent node becomes undefined) code fails and throws error.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 12:21:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/uncaught-typeerror-cannot-read-properties-of-null/m-p/1347085#M82724</guid>
      <dc:creator>mattheol</dc:creator>
      <dc:date>2023-11-08T12:21:38Z</dc:date>
    </item>
  </channel>
</rss>

