Object of type 'Sale' not found with primary ID

mgkeeranmgkeeran Member Posts: 6

I searched but I did not see something on this. This appears to just have started happening with our integration.

Very recently we have had some retailers contact us about issues and I noticed that we have started encounter an odd error saying the Object of type ‘Sale’ not found. We are able to get the customer information from Lightspeed but not the sale information when that happens. Here is an example of the query string we receive from Lightspeed and then the responses in our log file:

Mon Mar 1 15:17:25 EST 2021 - Query String - [Retailer Name] - type=sale&accountID=[accountID]&systemUserID=[userid]&employeeID=1&saleID=580853&customerID=10116&shopID=4&registerID=20&returnURL=https%3A%2F%2Fus.lightspeedapp.com%2Fregister.php

We then call "https://api.merchantos.com/API/Account/[accountID]/Sale/580853.json?load_relations=[\"SaleLines.Item\"]";

This is the response:

Mon Mar 1 15:17:26 EST 2021 - INDEX [Retailer Name]



   [httpCode] => 404

   [httpMessage] => Not Found

   [message] => Object of type 'Sale' not found with primary ID '580853'.

   [errorClass] => Exception


These calls are within a second of each other so I would think the sale would still exist. It is only happening to some retailers. Most are still working fine. Any help would be appreciated.


  • gregaricangregarican Member Posts: 663 

    Are these happening pretty quickly after the actual sale was created? If so, perhaps code in a slight pause between sale creation and pulling its dataset. I know there are sometimes some time lags between created records and their accessibility.

  • mgkeeranmgkeeran Member Posts: 6

    @gregarican Thanks for the tip. The pull requires the retailer to click on a custom button (which ports them over to our platform) so I would think by the time they did that, the sale would be available but that is still the best probable cause I have heard. I think I will try to trap the error, pause and try again. Most of the time everything works just fine.

  • gregaricangregarican Member Posts: 663 

    Hope that's the quick fix. I know I've had to include a slight 5-10 second pause in places when it comes to transactions fully committing so they are accessible. 😀

  • mgkeeranmgkeeran Member Posts: 6

    Unfortunately that did not do it. I added a full 10 second wait and it still is giving me the same issue. For one retailer everything worked just fine for a very long time until Feb 24. And it just won't work at all for them now. But other retailers it is intermittent. Does anyone from Lightspeed support look at these are we just on our own.

  • gregaricangregarican Member Posts: 663 

    Some Lightspeed staff check in every day or so I think. 🤷‍♀️

    Maybe there is an issue where the Account ID, Sale ID, etc. are getting mis-referenced somehow when you are receiving the values? Can you log into that Retail user's shop? If so maybe run through the routine and it might shed some light on what's going on.

  • mgkeeranmgkeeran Member Posts: 6

    Thanks. Yeah, I'm gonna have to at least do a screen share. It's strange because it varies. Most of my retailers are working just fine, no issues. A few others, it happens occasionally. And then a couple of them, who were working perfectly fine as of last week, it doesn't work at all (but I can grab customer information so I know the app and credentials are working). Very strange and a bit frustrating for sure. Had this integration working fine for over four years until this weekend.

Sign In or Register to comment.