Question

Invalid credentials issue with error code 521

  • 8 November 2022
  • 7 replies
  • 331 views

Badge +2

We are able to list and purchase the subscriptions but revenue cat can not handle the subscriptions.


2022-11-08 21:34:30.510 12259-12372 [Purchases] - WARN          W  ⚠️ Unable to start a network connection due to a network configuration issue: https://api.revenuecat.com/v1/receipts
2022-11-08 21:34:30.510 12259-12372 [Purchases] - DEBUG        D  ℹ️ API request started: POST /receipts
2022-11-08 21:34:30.514 12259-12372 [Purchases] - DEBUG        D  ℹ️ API request completed with status: POST /receipts 521
2022-11-08 21:34:30.515 12259-12372 [Purchases] - ERROR        E  🤖‼️ There was a credentials issue. Check the underlying error for more details.


7 replies

Userlevel 4
Badge +8

The 521 code is indicating that "The origin server refused connections from Cloudflare. Security solutions at the origin may be blocking legitimate connections from certain Cloudflare IP addresses". Can you check your network to make sure everything is okay there?
 
If everything checks out with your network, then I have found the "Invalid Play Store credentials" happening is almost always due to a configuration error. Can you confirm you set up your permissions correctly? https://www.revenuecat.com/docs/creating-play-service-credentials  
 
The steps I find are usually missed or done incorrectly are the following:

  1. https://www.revenuecat.com/docs/creating-play-service-credentials#2c-create-the-service-account-key-credentials
  2. https://www.revenuecat.com/docs/creating-play-service-credentials#3-grant-financial-access-to-revenuecat

 
Generally going through these steps again seems to help a lot of people as they might have missed steps. One thing to check is also that you are linking the correct Google Cloud project.
 
Please double-check those for me. If this still doesn't fix the problem, please let me know!

Badge +2

I check these steps several times but it is not working. I have also another app with different revenuecat account and implement revenuecat on it but it also gives error code 520.

Userlevel 4
Badge +8

Thank you for letting me know! Our SDK is programmed to automatically retry any 5xx response, so these requests should get replayed and succeed eventually after the credentials are fixed. With Invalid Credentials, it indicates that RevenueCat is not able to communicate with Google at the moment. 

I recommend generating new service credentials to wait out the propagation time (up to 36 hours for new credentials to work). If you have your current service credentials JSON, I also recommend re-entering those credentials inside the RevenueCat settings page. I have seen that sometimes regenerating them and waiting will fix this error.

Badge +2

After waiting for a week it resoved by own. 

Badge

Hi all, 

I am having the exact same issue. I’ve been testing the app for some time and it just started happening out of the blue. I am getting:

Unable to start a network connection due to a network configuration issue: https://api.revenuecat.com/v1/receipts

API request started: POST /receipts

API request completed with status: POST /receipts 521

There was a credentials issue. Check the underlying error for more details.

I created new service accounts. Should I just wait and see if it solves by itself?

Thanks.

Badge +2

Hi all, 

I am having the exact same issue. I’ve been testing the app for some time and it just started happening out of the blue. I am getting:

Unable to start a network connection due to a network configuration issue: https://api.revenuecat.com/v1/receipts

API request started: POST /receipts

API request completed with status: POST /receipts 521

There was a credentials issue. Check the underlying error for more details.

I created new service accounts. Should I just wait and see if it solves by itself?

Thanks.

This error continued nearly a week in our case. Hope it is solved earlier for you.

Userlevel 4
Badge +8

@Bogdan Nistor yes, waiting after regenerating should fix the error. And don’t forget to re-enter those credentials inside the RevenueCat settings page.

Reply