Getting `urllib.error.HTTPError: HTTP Error 500: Internal Server Error` when saving an order.

Shopify Partner
5 0 0

I'm getting an intermittent errors (`urllib.error.HTTPError: HTTP Error 500: Internal Server Error` & `pyactiveresource.connection.ServerError: Internal Server`), when trying to save a new order. I'm using `ShopifyAPI==3.1.0`

Here is the traceback that I'm seeing in the logs:

 

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/pyactiveresource/connection.py", line 286, in _open
http_response = self._handle_error(self._urlopen(request))
File "/usr/local/lib/python3.6/dist-packages/pyactiveresource/connection.py", line 316, in _urlopen
return urllib.request.urlopen(request, timeout=self.timeout)
File "/usr/lib/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.6/urllib/request.py", line 570, in error
return self._call_chain(*args)
File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 500: Internal Server Error
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/var/www/html/shopifyapp/util.py", line 252, in create_shopify_order
order.save()
File "/usr/local/lib/python3.6/dist-packages/pyactiveresource/activeresource.py", line 824, in save
data=self.encode())
File "/usr/local/lib/python3.6/dist-packages/pyactiveresource/connection.py", line 364, in post
return self._open('POST', path, headers=headers, data=data)
File "/usr/local/lib/python3.6/dist-packages/shopify/base.py", line 23, in _open
self.response = super(ShopifyConnection, self)._open(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/pyactiveresource/connection.py", line 288, in _open
http_response = self._handle_error(err)
File "/usr/local/lib/python3.6/dist-packages/pyactiveresource/connection.py", line 418, in _handle_error
raise ServerError(err)
pyactiveresource.connection.ServerError: Internal Server Error

When I retry that I end up with double orders.

0 Likes
Highlighted
Shopify Staff
Shopify Staff
268 36 40

Hey @radi_ 

 

Can you please provide a request id (from the response headers)?

0 Likes
Shopify Partner
5 0 0

I don't have that information. We do not log response headers. 

 

Do you need anything else?

0 Likes
Shopify Partner
5 0 0

Hey, @scottydont would you please give me an update on this issue?

0 Likes
Shopify Staff
Shopify Staff
268 36 40

Hey @radi_

 

I'll need a request ID to dig deeper - are you able to log some details?

0 Likes
Shopify Partner
5 0 0

@scottydont wrote:

Hey @radi_

 

I'll need a request ID to dig deeper - are you able to log some details?


I don't think I have a request ID. Could you give me an example of what might look like?

 

It's an internal server error. I wouldn't have much more info than the error tracebacks I posted.

0 Likes
Shopify Staff
Shopify Staff
268 36 40

The request ID should be in the header (even for an internal server error) - are you able to log the response header?

 

It looks something like this:

 

x-request-id: c395e33c-36b6-4293-820a-9639e3b58dc5

0 Likes
Shopify Partner
5 0 0

I don't have that ID.

 

Can you still look at the issue if you don't have that ID?

0 Likes