This is an archived forum post. The information may be outdated. Contact us if you have any questions.

frustrating 502 - "Sorry we couldn't process your request."

nutrislice wrote on 2012-08-04:
When i run the following python script
import pdfcrowd
client= pdfcrowd.Client(PDFCROWD_ACCOUNTNAME, PDFCROWD_KEY)
pdf_string = client.convertURI("http://dcsd.nutrislice.com/menu/eldorado/lunch/pre-pdf-html")



I get a 502 response/exception:

Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/ben/Envs/menus_proto/lib/python2.7/site-packages/pdfcrowd.py", line 82, in convertURI
    return self.__convert(outstream, 'uri', uri)
  File "/Users/ben/Envs/menus_proto/lib/python2.7/site-packages/pdfcrowd.py", line 255, in __convert
    return self.__call_api(uri, out_stream, src)
  File "/Users/ben/Envs/menus_proto/lib/python2.7/site-packages/pdfcrowd.py", line 272, in __call_api
    raise Error(why.read(), why.code)
Error: 502 - Sorry, we couldn't process your request.



I have used the python client successfully with different (although less full) menus, e.g. http://dcsd.nutrislice.com/menu/castle-view/lunch
Also, the url works if I try it directly in the "Create PDF Online" Service


We're a paying client, likely to upgrade to bigger and bigger monthly allowances as our company is taking off. But this is a bit frustrating. Any clues here, pdfcrowd support?
support wrote on 2012-08-05:
We need to investigate this deeper but for now a workaround is to to add the following line before client.convertURI():
client.setHtmlZoom(100)


I also noticed that the page loads http://dcsd.nutrislice.com/menu/eldorado/images/menus/month-bg-portrait.png which returns 500 (Internal Server Error). This is unrelated to the 502 error though.
nutrislice wrote on 2012-08-06:
Thanks for the work around.

I realized after posting that its probably has something to do with us trying to jam too much into the page, or using javascript to dynamically size the contents when the page is loaded. Our original test cases had fewer & shorter menu items. I'm reworking it as a 2 page PDF.
nutrislice wrote on 2012-08-06:
Thanks for your response, and the work around.

I realized after posting that its probably has something to do with us trying to jam too much into the page and/or using javascript to dynamically size the contents when the page is loaded. Our original test cases had fewer & shorter menu items. I'm reworking it as a 2 page PDF.
support wrote on 2012-08-07:
Yes, it looks like GetBoundingClientRect() is repeatedly called from an infinite loop. Our converter aborts the conversion after 40 seconds and returns the 502 error. The problem is related to the PDF page width somehow - the conversion completes successfully when landscape is used.