Print Task - Execute URL Cancelled

174
4
10-27-2021 07:17 AM
AndrewMurdoch1
Occasional Contributor II

Good Day

I'm trying to print a large view of ~4600 segment, after pressing the print button, which executes the following function:

printMap() {
try {
const printTask = new PrintTask();
printTask.url = 'https://utility.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task';

const template = new PrintTemplate({
format: 'jpg',
layout: 'a4-landscape',
});

const params = new PrintParameters({
view: this._view,
template: template
});

this.printProgress = true;
printTask.execute(params).then((result) => {
this.printProgress = false;
window.open(result.url);
}, (err) => {
this.printProgress = false;
this.alert.errorDialog('Print Error', 'Please try again or contact support!');
});
} catch (error) {
console.log(error);
}
}

 I get 'cancelled' in the network tab of the Dev Console:

AndrewMurdoch1_1-1635343724559.png

I'm assuming this is a timeout issue, due to the amount of data being sent, is there a way to add a timeout override to the execute call?  Is there an upper limit to the amount of data you can push from a client side ArcGIS JS Map to the Print Service?

Thanks

Tags (2)
0 Kudos
4 Replies
ReneRubalcava
Frequent Contributor

You can try providing a requestOptions object as the second arg of the execute command that sets the timeout to 0.

https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html#RequestOptions

0 Kudos
AndrewMurdoch1
Occasional Contributor II

Thanks!  I'll try that :)

0 Kudos
AndrewMurdoch1
Occasional Contributor II

After changing the timeout to 0, I'm no longer getting the cancelled request, but I'm getting lots of 500 / 504 errors.

AndrewMurdoch1_1-1635346863242.png

The 200 at the top had a 500 response inside it:

AndrewMurdoch1_2-1635346925369.png

I ran the same test several more times, and was able to get a response, and the only different I can see is that the successful one took 1.9 minutes, and all the failures took 1.0 minutes or 2.0+ minutes.

This is the capture of the other responses, the top 200 was actually successful, the second was had a 500 response code it:

AndrewMurdoch1_3-1635347058456.png

 

Thanks

 

0 Kudos
AndrewMurdoch1
Occasional Contributor II

Has anyone seen this kind of behaviour?

0 Kudos