Calling AWS from Azure APIM not giving response few times - Intermittent issue - java

There is an issue while calling the REST API and the application resides in AWS. This call is made from Azure APIM and kind of PROXY call. It means , in the Java code there is an another URL visible to the user and while calling in turn call the REST API of the application which is in AWS.
There is an intermittent issue of not getting response few times. Most of the times , there is 200 response but few times 500 INTERNAL SERVER error is returned.
Mostly , this seems there is a network issue.
As a workaround , retry mechanism is added to call the API 3 times. Still , few failures are noticed in production.
As of today, it's an unknown that where exactly the request from Azure (APIM) -> AWS is rejected/lost.
2.The request is not reaching HAPROXY in AWS side
requesting experts to help with your suggestions for the further investigation steps.

Related

Http 503 for some Rest api call

I am running an SpringBoot application and I have a controller which defines Rest Api and accepts a request by a list of ids. Normally it works fine but if number of ids gets bigger, then I receive http 503. Interesting thing is that I cannot see any logs that my request was received by controller as well. Therefore I am not able to understand what is happening. Do you have any idea what can be worth to check ?
503 is a error code, which means service or url or controller, that you are requested is not running/available, make sure your jar file is running and also make sure the url you requested is valid. since service is not available you cant see any logs or error messages. because your controller dint receive any request yet.
The 503 error indicate that the server is not ready to handle the request.
There are some limitations for transferring data through URL , basically the length of the URL
In general the limit was 2047 chars and it is different for different browsers
503 means Service Unavailable.
I think something is wrong with your request.
You can try to add a custom OncePerRequestFilter and log your HTTP Request.

How do I generate refresh tokens for Google API using Java Client Library?

I have checked the multitude of responses earlier and none of them actually address the issues. The responses, much like the documentation, assume that the user is already aware of all possible flows.
Constraint: We cannot set the app to external in GCP console and ideally don't want a service either.
This leads to any oauth playground based approaches into a 403 Exception.
I tried generating it based on the get requests mentioned on their websites.
https://accounts.google.com/o/oauth2/v2/auth?
scope=https%3A//www.googleapis.com/auth/drive&
access_type=offline&
include_granted_scopes=true&
response_type=code&
prompt=select_account&
redirect_uri=https%3A//developers.google.com/oauthplayground&
client_id=xyz
I have also tried prompt=consent here. Both also result in 403.
Generating with LocalReceiver also has issues with redirect uri mismatch even though it has been authorized on the console.
Particularly perplexed by the fact that the account for which it is throwing 403 is the account that owns the project. So it can't access its own services.
Thanks

Get Resource Details in Azure Subscription using Java Rest API

I have a Java Application running on Tomcat. I want to get the details of all machines installed in Microsoft Azure portal by taking user's subscription details as input. Preferably a REST API. I am expecting response same like what we get in azure resource explorer.
I made a request with this url "https://management.core.windows.net/"+subscriptionId+"/services/disks" following this method. It gives me result like this
<Disks xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Disk>
<AttachedTo>
<DeploymentName>TEST1</DeploymentName>
<HostedServiceName>TEST1</HostedServiceName>
<RoleName>TEST1</RoleName>
</AttachedTo><OS>Linux</OS>
<Location>South Central US</Location>
<LogicalDiskSizeInGB>30</LogicalDiskSizeInGB>
<MediaLink>link.vhd</MediaLink>
<Name>TEST1-TEST1-0-20</Name>
<SourceImageName>imageName</SourceImageName>
When I call the same method with
"https://management.azure.com/subscriptions/"+subscriptionid+"/providers/Microsoft.Compute/virtualMachines?api-version=2016-03-30" I am getting 401 error.
I even tried downloading the SDK , ListVirtualMachines.java is listing some 600 images, not the one under my subscription.
How Can I achieve it using JAVA REST API?
Per my experience, this issue is due to the authentication method. I do all the requests that you have made and I get the same results with you.
The 401 error code means "Unauthorized". Your authentication method is right for the old REST API request, but not for new.
The new authentication is handled by Azure Active Directory(AD).
The followings may be useful for you.
You could figure out Virtual Machines Rest API by this URL https://msdn.microsoft.com/en-us/library/mt163647.aspx.
You could understand how to authenticate Azure Resource Manager Request by Azure Active Directory by this URL https://msdn.microsoft.com/en-us/library/dn790557.aspx.
Hope it helps. Any concerns, please feel free to let me know.

Android: Getting HTTP 403 Forbidden upon calling https://maps.googleapis.com/maps/api/geocode/xml

I've developed an Android Application since 2012. Since now I've made use of the free web service api v3 for geocoding without an API key so that we have a limit of 2,500 request per IP and not for KEY without problems:
https://maps.googleapis.com/maps/api/geocode/xml
All has worked fine until this period when sometimes some of my users soffers of error 403 - Forbidden during this web server call.
Has Google Changed something for the use of his webservices?
Eventually I could use the Geocoder class of the Android Framework.
But I've still another webservice that i call:
https://maps.googleapis.com/maps/api/directions/xml
Could also this webservice suffer of the 403 error? Up to now I don't know because if I get 403 error in geocode I won't call the direction webservice.
Here's a little information you may want to look over... You can find more about this here.
HTTP 403 response
Requests to the web services may also receive a HTTP 403 (Forbidden)
error. In most cases, this is due to an invalid URL signature. To
verify this, remove the client and signature parameters and try again:
If the response is HTTP 200 (OK), the signature was the problem. This
is not related to usage limits; see Troubleshooting authentication
issues in the Web Services chapter of the Google Maps API for Work
documentation for details. If the response is still a HTTP 403
(Forbidden) error, the signature was not necessarily the problem, it
may be related to usage limits instead. This typically means your
access to the web service has been blocked on the grounds that your
application has been exceeding usage limits for too long or otherwise
abused the web service. Please contact Google Enterprise Support if
you encounter this issue. Requests to all web services require URL
signatures. Requests will also be rejected with a HTTP 403 (Forbidden)
error when including the client parameter but missing the signature
parameter, or vice versa.
Problems
You can exceed the Google Maps API Web Services usage limits by:
Sending too many requests per day. Sending requests too fast, i.e. too
many requests per second. Sending requests too fast for too long or
otherwise abusing the web service. Exceeding other usage limits, e.g.
points per request in the Elevation API.
Solutions
The above problems can be address by combining two approaches:
Lowering usage, by optimizing applications to use the web services
more efficiently. Increasing usage limits, when possible, by
purchasing additional allowance for your Google Maps API for Work
license. This article will focus on ways of optimizing applications to
use the web services more efficiently.
Here's another good link that may just help as well.

receiving Google Cloud Endpoints 204 No Content until shutdown - restart

I've got an application on App Engine (Java) with a Cloud SQL db behind it. My mobile app connects with it via Google Cloud Endpoints.
The issue is, that when I leave an instance idle for a long time, the next time I do a request on an endpoint (even with a simple GET request in the browser/Postman in Chrome), I almost always get a 204 No Content back. The app engine logs just seems normal. However, once I shutdown the instance, and do the request again, I always get the response JSON i need.
Furthermore, once it DOES respond, it keeps responding until I leave it idle for a longer period. Then again I often get a HTTP 204.
Any advice?
Please take a look at this FAQ - https://developers.google.com/cloud-sql/faq#sometimes_slow

Categories

Resources