We use custom dojo build to build arcgis js api. The configuration build.profile.js file is always the same as one from the official example from github, the only difference is paths. After updating to version 4.17 we started getting errors after applyEdits operations(Updating object in Editor widget). The exception is below, exception throws during query operations after applyEdits and only for feature layers that are loaded as json, e.g. there is no error after editing objects from Feature layer that is loaded as pbf buffer.
"TypeError: Cannot read property 'length' of undefined
at Function.d.fromOptimizedFeatureSet (http://<>/esri/views/2d/layers/features/Pipeline.js:1153:197)
at Function.d.fromFeatureSet (http://<>/esri/views/2d/layers/features/Pipeline.js:1152:492)
at c.<anonymous> (http://<>/esri/views/2d/layers/features/Pipeline.js:979:91)
at d (http://<>/dojo/dojo-lite.js:47:190)
at Object.next (http://<>/dojo/dojo-lite.js:45:492)
at g (http://<>/dojo/dojo-lite.js:45:275)"
I tried to change url for loading arcgis js from custom to http://js.arcgis.com/4.17cdn and there were no errors.
After debuging Pipeline.js I found a difference between http://js.arcgis.com/4.17 Pipeline.js and local, JSON parsed FeatureSet after query often has parameter fields = undefined because there is no features found in specific geometry.
So after Convert function it throws error during for loop because a is undefined. In Pipeline.js from http://js.arcgis.com/4.17 fields are always  instead of undefined.
I modified wrong line localy
and it fixed the error.
Is anyone facing the same issue?
Solved! Go to Solution.