Copy link to clipboard
Copied
Hi team,
When I tested PDF Extract API whith a sample pdf file it was working fine, but occassionaly I am getting below mentioed exception for the same pdf file. What could be the reason for this? And how to handle such exceptions? Thank you!
EXCEPTION:
raise SdkException("Request could not be completed. Possible cause attached!", sys.exc_info()) adobe.pdfservices.operation.exception.exceptions.SdkException: description =Request could not be completed. Possible cause attached!, requestTrackingId=(<class 'requests.exceptions.ConnectionError'>, ConnectionError(ProtocolError('Connection aborted.', timeout('The write operation timed out',)),), )
Copy link to clipboard
Copied
Hi Ashish5C1E,
The error message "The write operation timed out" indicates that the upload is not completing. Since you mentioned that the issue is intermittent, it could be a combination of a large file size and your network quality. If you can share the request id in one of the responses where you receive this error we can look further. It would also help us to troubleshoot if you could share your original file either by posting here or sharing via email to extractapi@adobe.com.
Copy link to clipboard
Copied
Hi Chris,
The pdf contains sensitive data and I can't share it. For the extraction I am using the below-mentioned python code, with that, I am unable to find the request-id. Can you please let me know how can I get the request-id?
GIT - https://github.com/adobe/pdfservices-python-sdk-samples
Thank you!
Copy link to clipboard
Copied
Hi Ashish5C1E,
The request id should be included in the API response. If you don't have the original response, if you could share the request id the next time you see the error, we'll take a look. We won't be able to see the content, but we will be able to see if there are any errors within our pipeline.
Copy link to clipboard
Copied
adobe.pdfservices.operation.exception.exceptions.ServiceApiException: description =Unable to process the message even after retries; requestTrackingId=zJZRcZcGn5vwGOgVrVQcE4EpxnhDdDi0; statusCode=500; errorCode=UNKNOWN
Copy link to clipboard
Copied
Thanks for your response on this @Chris French DC, facing a similar issue with an ~6MB PDF (well below the 100MB API limitation).
Here's the trace of the API request:
[2022-06-03 11:19:16][ERROR][pdfContentExtraction][RequestId:68a53c4c-e0ce-3443-99fc-695afb01732a]:Exception encountered while executing operation
Traceback (most recent call last):
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/urllib3/connection.py", line 234, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/lib/python3.8/http/client.py", line 1256, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1302, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1251, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1050, in _send_output
self.send(chunk)
File "/usr/lib/python3.8/http/client.py", line 972, in send
self.sock.sendall(data)
File "/usr/lib/python3.8/ssl.py", line 1204, in sendall
v = self.send(byte_view[count:])
File "/usr/lib/python3.8/ssl.py", line 1173, in send
return self._sslobj.write(data)
socket.timeout: The write operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 531, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/urllib3/packages/six.py", line 734, in reraise
raise value.with_traceback(tb)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/urllib3/connection.py", line 234, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/lib/python3.8/http/client.py", line 1256, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1302, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1251, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.8/http/client.py", line 1050, in _send_output
self.send(chunk)
File "/usr/lib/python3.8/http/client.py", line 972, in send
self.sock.sendall(data)
File "/usr/lib/python3.8/ssl.py", line 1204, in sendall
v = self.send(byte_view[count:])
File "/usr/lib/python3.8/ssl.py", line 1173, in send
return self._sslobj.write(data)
urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/http/http_client.py", line 70, in _execute_request
response = requests.post(url=http_request.url,
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/requests/api.py", line 119, in post
return request('post', url, data=data, json=json, **kwargs)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/requests/api.py", line 61, in request
return session.request(method=method, url=url, **kwargs)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
resp = self.send(prep, **send_kwargs)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/requests/adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', timeout('The write operation timed out'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/nik/pythonProjects/etg/handleExtractingPdfContents.py", line 56, in handle_extracting_pdf_content
result: FileRef = extract_pdf_operation.execute(execution_context)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/adobe/pdfservices/operation/pdfops/extract_pdf_operation.py", line 131, in execute
location = ExtractPDFAPI.extract_pdf(execution_context, self._source_file_ref, self._extract_pdf_options)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/service/extract_pdf_api.py", line 42, in extract_pdf
location = CPFApi.cpf_create_ops_api(context, cpf_content_analyzer_req, [file_ref],
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/api/cpf_api.py", line 63, in cpf_create_ops_api
response = http_client.process_request(http_request=http_request,
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/http/http_client.py", line 41, in process_request
response = _execute_request(http_request)
File "/home/nik/pythonProjects/etg/venv/lib/python3.8/site-packages/adobe/pdfservices/operation/internal/http/http_client.py", line 81, in _execute_request
raise SdkException("Request could not be completed. Possible cause attached!", sys.exc_info())
adobe.pdfservices.operation.exception.exceptions.SdkException: description =Request could not be completed. Possible cause attached!, requestTrackingId=(<class 'requests.exceptions.ConnectionError'>, ConnectionError(ProtocolError('Connection aborted.', timeout('The write operation timed out'))), <traceback object at 0x7f56073b2bc0>)
As seen in the logs, the request-id is not visible. Would be helpful if you can provide clarity on why this mission-critical part of your app is failing. PDF which returns the error is attached.
Copy link to clipboard
Copied
* why this mission-critical part of our app is failing
Copy link to clipboard
Copied
I am getting this same message. It was working fine a few weeks ago.