Why doesn't my feature layer appear in the map in 4.x but it does in 3.x?

1129
7
12-22-2020 04:08 PM
ValCannon2
New Contributor III

Hello,

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.

https://codepen.io/valcannon/pen/zYKEqdy

https://codepen.io/valcannon/pen/oNzGxov

 

 

0 Kudos
7 Replies
by Anonymous User
Not applicable

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.

0 Kudos
ValCannon2
New Contributor III

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.

0 Kudos
by Anonymous User
Not applicable

Try with this ms. https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/3 works for me.

These are the errors I get in my console log if I try your ms. 

AdamArcichowski_0-1609177160383.png

 

 

0 Kudos
ValCannon2
New Contributor III

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?

0 Kudos
ValCannon2
New Contributor III

My CodePen tests use an Esri map service but I am having the same issue with an in-house map service.

0 Kudos
ChristianPagel1
New Contributor II

4.18 does not support MS Edge Legacy, try 4.17 or Chrome

0 Kudos
ValCannon2
New Contributor III

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.

0 Kudos