Select to view content in your preferred language

Print Component Cors Error on Export

89
2
Jump to solution
Wednesday
ShainaR
New Contributor

I have an application running version 4.32.8 of the sdk and am using the print component with a specified printServiceURL. The component loads fine initially and I can see all the options to print. But when I click the "Export" button. It would just show "an error occured while exporting the web map" in the exports tab. Then in the logs I get a CORS error. "Access to fetch at <my print service url> has been blocked by CORS policy. I know that the url works because it wouldn't load the component with all those options if it had the wrong link (I tried an invalid link, and it would just have an error has occured in the component) and we have a previous iteration of this application created years ago running at 4.26 that uses the Print widget and it works with no problems.

 

What I have looked at and compared was the actual requests that these Print widgets sent. The application with the issue sends the print execute request as a get request whereas the one with the working print widget sends the execute request as POST request. I have had experience where if the request string is too long in a get request it triggers the CORS error so wondering if there is a way to have the print use a POST request instead. Otherwise I have tried using a proxy url and that hasn't worked either.

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ShainaR
New Contributor

It was actually my fault here, I had set a maxUrlLength to the esri config to a higher limit. And according to the docs here depending on the limit, HTTP POST method will be used if it exceeds this limit. so I have removed that line, and it is making the request now as a POST request and is working now.

View solution in original post

2 Replies
ShainaR
New Contributor

It was actually my fault here, I had set a maxUrlLength to the esri config to a higher limit. And according to the docs here depending on the limit, HTTP POST method will be used if it exceeds this limit. so I have removed that line, and it is making the request now as a POST request and is working now.

Noah-Sager
Esri Regular Contributor

Thanks for sharing your issue and the resolution @ShainaR!

0 Kudos