AnsweredAssumed Answered

Invalid URL Error for Geoprocessing Service

Question asked by MollyKFoley on Mar 27, 2018
Latest reply on Mar 21, 2019 by Sigam_geo

I'm having a really hard time with this and I hope someone can shed some light. I've published a geoprocessing service that accepts uploads, I've also enabled "info" level messages. Unfortunately, nothing ever gets logged in server manager when this error occurs, so the messaging is kind of useless at this point. When I run the GP Service from ArcMap it works perfectly. When I run it from the rest API, I get a plain "failure" message. When I run it from my Javascript API, I get this error message:


I don't even know where to start debugging this. I don't know what URL it's looking evaluating as bad. I've never done a file upload via the Javascript API before so it could be something in the code that's wrong, but in the console it successfully uploads the zip file and creates an item ID, so it's uploading fine, I just can't seem to pass it to my GP service correctly. 

This is my javascript code:

  ) {

    var map = new Map("map", {
      basemap: "hybrid",
      center: [-77.069, 36.950],
      zoom: 14

    var featureLayer = new FeatureLayer("https://URL/servername/rest/services/HbMonitoringTest/HabitatData/MapServer/1");


    gp = new Geoprocessor("https://URL/servername/rest/services/Web_Map_GP_Services/ZipTest/GPServer");

    on(dom.byId("upload"), "click", upload);
    function upload(){
      //upload the zip file and get back the itemID (via uploadSucceeded) 
      console.log("Inside upload function now");
      var upload = esri.request({ 
        url: "https://URL/servername/rest/services/Web_Map_GP_Services/ZipTest/GPServer/uploads/upload",
        form: dojo.byId("uploadForm"), 
        content: {f: 'json'}, 
        handleAs: 'json',
      }).then(uploadSucceeded, uploadFailed); 
    function uploadSucceeded(response) { 
      var itemID = response["item"].itemID; 
      console.log("File upload successful, item ID: ", itemID);
      var params = {"Input_Zip_File": "{'itemID':" +itemID+ "}" };
      console.log('Input parameters: '+ dojo.toJson(params));
      console.log("submitting job");
      gp.submitJob(params, gpJobComplete, gpJobStatus, function(error){
        console.error(error.jobStatus + '(' + error.jobId + '):' + dojo.toJson(error));
    function gpJobComplete(result){
      console.log(result.jobStatus + '(' + result.jobId + ')')
    function gpJobStatus(result){
      console.log(result.jobStatus + '(' + result.jobId + '):' + dojo.toJson(message));
    function uploadFailed(response){
      console.log("Failed: ", response);



I've tried running it in the rest API, it successfully creates a job, but the process fails.

Input page:

After clicking "Submit Job (POST)":