External host out of reach - limit of requests?

During IAP receipt validation I need to perform two requests so my logic will behave correctly in case of Apple review. They use test accounts but fake the DNS so app points to production server. In that case my store logic needs
to try validating receipt in each server until it gets confirmation. Currently I am testing one of my JS scripts which
performs two requests to apple In App Purchase related hosts and only 1 request in several minutes
goes through. For others I get ehostunreach error. Because of that my
shop logic is useless. Is there a daily limit to how many requests to
external host can be called? If I wait few hours then 1 of my requests goes through and then I get the error again. Can you help me with that?

Hi Pawel,

A few questions for you:

    Does it fail in both debug (local coderunner) and production (cloud deployment) scenarios? Is is always the same host that fails or is it random?
Regards, Mark

Thanks Mark for such quick response. I’m using the same approach as with ShoppingCart example. Note that It is not a service hosted via Business Logic but just a javascript file in files>web>scripts. This check some dependencies if a product I want to buy exists and then it uses a javascript script to verify receipt with Apple server. I don’t really know how to debug it with CodeRunner. Today it seems to work correctly but I am wondering if failing was related to heavy testing and some limits? I can provide you with the receipt verification script so you can check it if you want?

Now every few requests with host unreachable I’m getting a different error, something like “Failed to retrieve billing information for previously allocated object”. Can you tell me something about that? I tried searching the forums but was not able to find any info. I did not modify anything in the script file today.

Sorry I think I answered incorrectly by adding new posts bellow. Can you take a look at them?

Hi, Pawel!

Please provide us your AppID so we can check your issue.

My application ID is: 9BD8EE9D-DF65-2CC1-FF65-52CF0162EC00

Hi Anatolli. Do you have any good news for me? Sorry if it seems like I’m rushing you guys. I love what you do for us developers with Backendless. I’m just really delayed because of this issue I’m having so I would like to resolve it somehow as quickly as possible. Thanks in advance!

Hi Pawel,

Can I test it somehow on your application? It would be very helpful if I could invoke some scripts from your File Service and see the issue. Could you please provide such steps?

I extracted the IAP verification code to seperate script: https://api.backendless.com/9BD8EE9D-DF65-2CC1-FF65-52CF0162EC00/v1/files/web/scripts/test-purchase.js. It has not authenticated permissions so you should be able to use it without user token and application id and so on. You can use Postman application to test it. It needs a post request with following body:

“receipt_metadata”:"{‘signature’ = ‘AluGxOuMy+RT1gkyFCoD1i1KT3KUZl+F5FAAW0ELBlCUbC9dW14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YxLQMg4WTQfgkQQVy8GXZwVHgbE/UC6Y7053pGXBk51NPM3woxhd3gSRLvXj+loHsStcTEqe9pBDpmG5+sk4tw+GK3GMeEN5/+e1QT9np/Kl1nj+aBw7C0xsy0bFnaAd1cSS6xdory/CUvM6gtKsmnOOdqTesbp0bs8sn6Wqs0C9dgcxRHuOMZ2tm8npLUm7argOSzQ==’;‘purchase-info’ = ‘ewoJInF1YW50aXR5IiA9ICIxIjsKCSJwdXJjaGFzZS1kYXRlIiA9ICIyMDExLTEwLTEyIDIwOjA1OjUwIEV0Yy9HTVQiOwoJIml0ZW0taWQiID0gIjQ3MjQxNTM1MyI7CgkiZXhwaXJlcy1kYXRlLWZvcm1hdHRlZCIgPSAiMjAxMS0xMC0xMiAyMDoxMDo1MCBFdGMvR01UIjsKCSJleHBpcmVzLWRhdGUiID0gIjEzMTg0NTAyNTAwMDAiOwoJInByb2R1Y3QtaWQiID0gImNvbS5kYWlseWJ1cm4ud29kMW1vbnRoIjsKCSJ0cmFuc2FjdGlvbi1pZCIgPSAiMTAwMDAwMDAwOTk1NzYwMiI7Cgkib3JpZ2luYWwtcHVyY2hhc2UtZGF0ZSIgPSAiMjAxMS0xMC0xMiAyMDowNTo1MiBFdGMvR01UIjsKCSJvcmlnaW5hbC10cmFuc2FjdGlvbi1pZCIgPSAiMTAwMDAwMDAwOTk1NzYwMiI7CgkiYmlkIiA9ICJjb20uZGFpbHlidXJuLndvZCI7CgkiYnZycyIgPSAiMC4wLjgiOwp9’;‘environment’ = ‘Sandbox’;‘pod’ = ‘100’;‘signing-status’ = ‘0’;}"

Currently it returns following error:

“data”: {
“errno”: “EHOSTUNREACH”,
“syscall”: “connect”,
“address”: “”,
“port”: 443
“message”: “error”,
“status”: false

Where data object contains the response from Backendless logic. Expected behaviour is to receive error with one of the numbers from following page: https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html (I’m using old receipt data so it will return IAP error).

I can’t seem to get a hang of replying on the forum. I left a response below with instructions how to access and test my script.

Hi Pawel,

Thanks for the details, we’ve managed to find a problem in our server code. The permanent fix will be available with the next release (1-2 weeks approximately).

For now your application should work fine in case you don’t change the external hosts (add new or remove existing). In case you don’t need to change them, could you please verify that everything is working for you now?

Yes! Now everything is working just fine! Thanks a lot!

Hello Sergey. My application is experiencing the same issue again. Was the fix deployed to the server already? I’m really close to deployment of the app and this unstable server logic is making me worried. Please help!

Can you help me again? I’m still experiencing the same issue. It came back after some time.

Hi Pawel,

I’m already looking into it, will notify you as soon as I find the problem.
Can you please prepare that test_purchase.js script again? It would help a lot.

Script is ready: https://api.backendless.com/9BD8EE9D-DF65-2CC1-FF65-52CF0162EC00/v1/files/web/scripts/testPurchase.js

Today it seems to work. I am wondering if it is related to times when server is idle for a long time. Is it possible?

Have you changed any of the external hosts?

I did not change them. I set them up once and they are correct URLs from Apple documentation so there was no need to modify them.

That’s strange. Anyway, the fix has just been deployed to the production server (somehow it was lost earlier) and now this should work fine. Please try again.