I am trying to migrate a simple map from JS API 3x to 4x. My test is a simple basemap with one feature layer added from a MapService. I have created what I think is the equivalent code in both APIs but it seems to work in 3x but not 4x. Will someone please take a look at these two pens and see if I made and obvious mistake. They are short, I promise.
I think it has something to do with security. Idunno why you can add it in JS3 and not JS4 but read the console log. I can't add https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3 to portal, AGOL or Pro.
Thanks Adam. Idunno either. There are no errors in the console and when I run this on my local server I get so many Fiddler responses related to VPN that I haven't been able to sort them out. That is why I posted it in CodePen, so I would know that it has nothing to do with my local security. Unless you are actually seeing the layer in the 4x version on CodePen.
Sure enough, that works for me as well. Back to the original question, why does the other map service draw in 3x but not 4x? Does something need to change on the map service? or my code?
Good point but not really important here unless you are actually seeing the layer in the 4x version on CodePen using any browser. What browser are you seeing it in? I'm using Chrome v87.0.4280.88 and Edge v87.0.664.66.