upgrading to 4.25, dojo/query and esri/rest/query are conflicting

857
6
Jump to solution
01-12-2023 11:59 AM
JayHill
Occasional Contributor II

I am upgrading an older web map from 4.17 to 4.25 and don't have the time to rebuild with ES modules. I'm looking for a way to call dojo/query and esri/rest/query by different names using AMD modules. 

 

Uncaught TypeError: query.executeQueryJSON is not a function

This error popped up after upgrading to 4.25 where the dojo library is no longed included with the CDN package.  Assuming this is the reason because 4.24 still works.

0 Kudos
2 Solutions

Accepted Solutions
MichaelSnook
Occasional Contributor III

Gotcha...I should have read slower...I have both in projects and I have the dojo/Query init function parameter set to 'query', and have the esri/rest/query parameter set to 'restQuery' -- then calling restQuery.executeQueryJSON works fine.  

View solution in original post

0 Kudos
MichaelSnook
Occasional Contributor III

Sure...

require([

        "esri/rest/query",               
        "dojo/query"
        
    ], function (
            
            restQuery,
            query
			
    ){	
	//esri restQuery call
	restQuery.executeQueryJSON(){
});			
	}

View solution in original post

0 Kudos
6 Replies
MichaelSnook
Occasional Contributor III

You can still pull dojo in via the dojoConfig a 4.25+...

See here:
https://developers.arcgis.com/javascript/latest/release-notes/#removal-of-non-esri-packages-from-cdn

 

 

packages: [
                {
                    name: "dojo",
                    location: "../../3.42/dojo"
                },
                {
                    name: "dijit",
                    location: "../../3.42/dijit"
                }
            ]

 

 

0 Kudos
JayHill
Occasional Contributor II

Right, I am pulling it from another CDN but I get "Uncaught TypeError: query.executeQueryJSON is not a function" error and I am assuming my code is confusing dojo/query and esri/rest/query as I use both for the app.

0 Kudos
MichaelSnook
Occasional Contributor III

Gotcha...I should have read slower...I have both in projects and I have the dojo/Query init function parameter set to 'query', and have the esri/rest/query parameter set to 'restQuery' -- then calling restQuery.executeQueryJSON works fine.  

0 Kudos
JayHill
Occasional Contributor II

Thanks @MichaelSnook would you have an example of the code?

0 Kudos
MichaelSnook
Occasional Contributor III

Sure...

require([

        "esri/rest/query",               
        "dojo/query"
        
    ], function (
            
            restQuery,
            query
			
    ){	
	//esri restQuery call
	restQuery.executeQueryJSON(){
});			
	}
0 Kudos
JayHill
Occasional Contributor II

Ah I see. So simple. Thanks!

0 Kudos