shippo-php-client icon indicating copy to clipboard operation
shippo-php-client copied to clipboard

Cannot Consistently Retrieve Shipping Rates.

Open ma077146 opened this issue 6 months ago • 6 comments

We are using shippo/shippo-php v1.5 installed via composer to actually make the API calls to Shippo.

Once we have all pertinent information, we make a call to Shippo via /vendor/shippo/shippo-php/lib/Shippo/Shipment.php create method, which in turn calls _scopedCreate() in abstract class Shippo_ApiResource class.

The returned Shippo Object is used to store what we call the “shipment_id” in our database.

Next, we make a call to the Shippo API with that “shipment_id” from above via /vendor/shippo/shippo-php/lib/Shippo/Shipment.php get_shipping_rates() function,

which uses the Shippo_ApiResource _scopedGet() method to return the rates to us.

The code on our side that calls the Shippo API is wrapped in a try/catch block. That is where the below error is from:

Unable to retrieve shipping rates for shipment ID: d94f493a0c304f14b99c0f583e398f68 | cURL error 28: Operation timed out after 30001 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://api.shipengine.com/v1/carriers

Everything in the above error starting with “cURL” is the exception from the catch block.

We flash a message at the top of the page that says, “Unable to retrieve shipping rates. Please reload the page to try again.“ which could be why some of the shipping object id numbers we have sent can be associated with rates that were fetched and returned.

Making the exact same API calls, there are two other variations of the errors we see when trying to retrieve shipping rates.

Unable to retrieve shipping rates for shipment ID: ff8f884fe6e14c44a4078c9e91741e1e | Trying to access array offset on value of type null

Unable to retrieve shipping rates for shipment ID: 678c0f65d6674bc2ab233c1ef2b78ea9 | Undefined array key "carriers"

These issues occur in bunches. We haven’t seen any since July 29, 2024, but between June 7, 2024 and July 29, 2024 we’ve had 268 such errors. That doesn’t sound like a lot, but it brings shipping to a halt, and the pharmacy is forced to log into UPS and FedEx via browsers to get shipping done, which greatly disrupts their work flow.

The pharmacy can have as many as 8 to 10 different people working on shipments during the day. Do you know if we are limited to making a certain number of requests within a given time period?

ma077146 avatar Aug 05 '24 13:08 ma077146