Woocommerce-services: BUG: "Failed to retrieve shipping label refund status: Unexpected server error." on orders with multiple products in single order.

Created on 4 May 2021  Â·  8Comments  Â·  Source: Automattic/woocommerce-services

BUG: "Failed to retrieve shipping label refund status: Unexpected server error."

Plugin Versions: 1.25.12 & 1.25.11

I have minimal PHP experience, but think I have this tracked down to the version / commit where this has broken.

If the project is short people please ping me with resources to get started and I will jump into fixing this issue myself. Happy to help where I can.

The Problem / How To Reproduce

The shop owner received multiple orders and on a order with multiple products they select 'Create Shipping Label' on the following URLs page by going to the left menu 'Woocommerce' > 'orders' and clicking into a order with multiple products on the right

URL: https://shopowner.com/wp-admin/post.php?post=9124&action=edit

The Shop owner goes through the process of buying the label, but is returned to the above URL afterwards and an error is displayed Failed to retrieve shipping label refund status: Unexpected server error.

No 'shipment tracking' section has been populated on this page like would be normally be seen and the the 'Create Shipping Label' button is still present for the order though charges are happening and email receipts are being sent to the shop owner.

What exactly is breaking?

When I pop into a browser console and watch the network tab on the above URL I see the following endpoint fails with error 403 in plugin version 1.25.11 and 1.25.12.

https://shopowner.com/wp-json/wc/v1/connect/label/9124/3707992,3707991,3707980,3707979,3707972,3707971

when I switch to plugin version 1.25.10 the endpoint works but is queried in a different way where the endpoint is queried one time for each label id instead of just once like in plugin 1.25.11 and 1.25.12 .

https://shopowner.com/wp-json/wc/v1/connect/label/9124/3707992
https://shopowner.com/wp-json/wc/v1/connect/label/9124/3707980

What Changed To Break This?

In the plugin version 1.25.11 – 2021-04-06 the following change log was recorded.

Tweak – Update the shipping label status endpoint to accept and return multiple ids.

I believe the following commit might have something to do with this: Click For The Commit

How does The Store Owner Bypass This Problem?

Install 'WP Rollerback Plugin' and down grade the 'WooCommerce Shipping & Tax' to version - 1.25.10

[Pri] CRITICAL

All 8 comments

Hey @ispeakcomputer , thanks for the super detailed bug report! It's really appreciated.

This indeed looks like a regression and should be fixed as soon as possible. I'm gonna give it critical priority, so it should be taken care of soon.

Thanks again for your help!

Hello @ispeakcomputer, thanks again for the detailed report! I've been looking into this issue a bit more and haven't been able to reproduce this. I can see those label IDs have been successfully purchased, so the error is only happening when trying to retrieve the label status, which should simplify things. As you noted the biggest difference between those versions is in trying to get multiple labels at once vs one at a time. The problem is if any one of the label statuses fails, the entire request will fail. A couple things that might help us narrow down the issue would be:

  • When you rollback the version and it makes the requests separately, do all of the requests succeed?
  • Under WooCommerce > Status > WooCommerce Shipping & Tax, you can enable Logging there and run the failed status checks again. If you could provide any info from those logs that would be a big help (a 403 as mentioned should show up in the Other Log area).
  • Is there a particular number of labels in a single order that causes the issue? Is this happening with any order that has more than one label?

Thanks for any help in narrowing down this issue!

I will take care of this right this afternoon and report back. Just wanted to give an update to let you know I was working on it.

The answers to your questions are as follows:

  • When I roll back the version all of the single and multiple label requests success. On the two newest versions single id requests work,but it doesn't work with multiple labels.
  • I am not seeing the log triggered and I think because this is actually a Javascript issue. That's my mistake. I have attached a screenshot of a failing endpoint as seen on the dev tools network tab
  • Its anytime there are more then one label. One label / item works ,but multiple items(and boxes) with labels fails.

failing javascript response

failing javascript

Thank you again for the details, sorry to ask for one more thing. Within that network tab, on the failed requests, would you be able to provide the contents on the Preview tab? I'm looking to see if there is any message along with the 403 by any chance?

Great idea. Didn't think about any of this.

Looks like this could be a server misconfigure by looking at this. What do you think?

Preview Tab Here

That does indeed look like a server level block. I did a quick test on the site and noticed that a comma in the URL causes the 403 response. You could look into any server configurations (or contact the hosting provider about this) or WordPress security plugins that may be performing this block.

Great thanks for the insights. Ill reach out to the hosting.

Was this page helpful?
0 / 5 - 0 ratings