AppSync 4XX Errors - amazon-cloudwatch

How to capture AppSync 4XX errors & 5XX errors in CloudWatch log insights.
I've setup an alert for both these metrics and getting frequent alarms but couldn't get the pattern to query the logs in log insights.
Tried checking for Status code in the Log Type: RequestSummary , but the count of 4XX isn't matching with the count from alert.

Related

Video of Youtube Data API V3 do not operate for a few hours

Youtube API do not work for a few hours regarding videos.
I checked autorization of API and tried to access with my key value regarding address below.
https://youtube.googleapis.com/youtube/v3/videos?part=snippet&chart=mostPopular&maxResult=25&key=[my key value].
However, output is whether or not error is displayed on console tab. error message is that Failed to load resource: the server responded with a status of 403 (Forbidden).
The portion of error is higher than no error for a few hours.
Could you let me know the root cause about this situation?

Podio API sandbox broken: no response but status 500 in console

Trying to submit a request in Podio API sandbox gives no error nor response, apart from status 500 in the console. Anybody here who can fix it?

In Angular6, what is the way to simulate receiving 4xx and 5xx responses from server

I am using HttpClient’s post method to send messages to the server. To test it, I want to simulate receiving 404 and 500 responses from the server. What is the way to simulate receiving 4xx and 5xx error messages in Angular6? As far as I know, I cannot use spyOn().and.returnValue because this will not simulate server error and will not trigger the error code handler passes to the post method.

How to show the internal server errors to the user?

I am working in an API . I want to throw detailed error messages to the user. Now i am in a situation to decide what kind of error code should be sent or how to explain user if any error occurs in the application internally. For example if database connection fails , what kind of http status code i want to send to the user ?
Can anyone help ?
An HTTP status code generally refers to the status of the HTTP request itself, not the status of the application handling the request. Therefore, most server-side errors are covered by 500 Internal Server Error. Any additional info about the error should be described in the response body. For APIs, the response body will often be JSON or XML, so you can use those formats for your errors. Something like this:
HTTP/1.1 500 Internal Server Error
[headers]
{"status":"error", "message":"The request failed due to database connectivity."}
There are, however, two cases I can think of when you might want another status code. If the user has requested an API method that is not implemented, you might want a 501 Not Implemented, and when there is a temporary service outage, you can use 503 Service Unavailable.
More info about server-side status codes here.

HTTP Status Code: 401 in GCMDemo

Reference:http://developer.android.com/google/gcm/demo.html
Server 401 when trying to send a message to my android device.
HTTP Status 500 - HTTP Status Code: 401
type Exception report
message HTTP Status Code: 401
description The server encountered an internal error (HTTP Status Code: 401) that prevented it from fulfilling this request.
exception
com.google.android.gcm.server.InvalidRequestException: HTTP Status Code: 401
com.google.android.gcm.server.Sender.sendNoRetry(Sender.java:177)
com.google.android.gcm.server.Sender.send(Sender.java:121)
com.google.android.gcm.demo.server.SendAllMessagesServlet.doPost(SendAllMessagesServ let.java:83)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.29 logs.
Could anybody tell me how to solve?Thank you!
You should take a look at the GCM docs where it explains the GCM response: http://developer.android.com/google/gcm/gcm.html#response and troubleshooting the 401 error code: http://developer.android.com/google/gcm/gcm.html#auth_error
Description from the docs:
Authentication Error
The sender account that you're trying to use to
send a message couldn't be authenticated. Possible causes are:
Authorization header missing or with invalid syntax.
Invalid project number sent as key.
Key valid but with GCM service disabled.
Request originated from a server not whitelisted in the Server Key IPs.
So I would check to make sure that you are setting you authorization header properly and that you Google Project number is properly setup with GCM and accepting your servers IP.