Stackdriver Error Email Notifications not Sending - google-cloud-platform

I want to get notifications by email for errors on my google cloud service.
It seemed pretty easy to setup. I just hit turn on notifications in Error Reporting in Stackdriver for all services (I only have 1 service).
I created some errors for testing, but didnt receive any emails.
Went into alert policy and profiles and added email notification as a channel. Still not notifications via email.
What am I doing wrong?

I think the best way to check if the notification is actually being sent is to post a test error message manually to the error reporting API.
First, verify that error notifications are available for the project, and then, run the following command on your cloud shell:
gcloud beta error-reporting events report --verbosity=debug --service Manual --service-version test1 \
--message "java.lang.TestError: msg
at com.example.TestClass.test(TestClass.java:51)
at com.example.AnotherClass(AnotherClass.java:25)"
You should receive an email from StackdriverNotifications-noreply#google.com
If you receive the notification for the test, your other errors might be misconfigured. If you don't receive it, then you might need to verify that the noreply address is not being blocked by your provider/filters.

Related

Get success status AWS SES

Prerequisites
I use AWS SES to send an email with event publishing to track the delivery status.
Problem
I'm looking for an event to make sure that an email is successfully sent to the end-user.
Description
Following AWS documentation, this type is suitable:
Deliveries – Amazon SES successfully delivered the email to the
recipient's mail server.
However, this event I get also in case Hard bounces.
For example, email status flow is:
Sends -> Deliveries - in case of successfull delivery
Sends -> Deliveries -> Hard bounces - in case I provide invalid recipient name, e.g. invalid#domain.com or 1234567890#domain.com
I don't expect Hard bounces after Deliveries.
If this behavior is correct then I need some additional event for sure success.
Something like this is expected in case of successfull delivery:
Sends -> Deliveries -> Success
I know that there are other "success" events like Opens, Clicks, Subscriptions, but they require additional action from the end-user.
Implementation details
I use Verified identity as an email sender.
A configuration set is used to redirect status events to SNS.
Finally, SQS is subscribed to this SNS to have all events in one place.
I tried several ways to send an email:
Java code using AWS SES SDK
Sending simulator with predefined and custom recipient's
The result is the same (as described above)
I think it is impossible to have a Success status because AWS cannot guarantee when the recipient mail server will reply with a Hard Bounce. You yourself have to define how long to you want to wait until you consider a delivery as successful. For example, if no hard bounce after 5 minutes, then it is a success.
If your use case is for analytics, I will simply capture more event types (for example log both Deliveries and Hard Bounces), and then count my success as Count of Deliveries - Count of Hard Bounces.
If your use case is for event-driven workloads, we need to define first what is considered a Success. For example, if we define Success as no Hard Bounce after 5 minutes, we can configure a Lambda function to trigger 5 minutes after a Delivery event. In the function, check if a subsequent Bounce event occurred. If not, the delivery is considered successful and then you can proceed to do what you want to do.
This is what I got from aws support about delivery status of an email.
Amazon SES will continue making several delivery attempts until
receiving a successful response from the recipient mail server, or
until 840 minutes elapse. If Amazon SES is still unable to deliver
the email/message during this period, it stops sending the email and
will then return a bounce message/notification.
According to this you can't be sure about the bounce or any other status within 5 minutes.
AWS does not have visibility to confirm if the Recipient Mail Server was able to deliver the message to the recipient email address when you get a 250 OK(it's confirmation that aws has delivered the message to recipient's mail server).
So there is no way you can be sure.

"Service unavailable" when sendmail relays through SES

Edit: It seems that when sending via cron, sendmail isn't using the 'from' domain set in the config, and so the message is being rejected by SES as an unverified domain. So the question is now, why isn't sendmail using these settings in the config when running from cron?
This is a bigger issue than this question, but this part seems to sum it up completely.
I have a number of ec2 instances. These use sendmail to relay messages through SES.
There are a number of bash scripts on these servers that email reports when the script has completed.
If I manually run one of these scripts, the email successfully sends. However, if run by cron, I see "dsn=5.0.0, stat=Service unavailable" in the maillog.
Sendmail is accepting the message, but relaying it through SES generates this error.
I know the environment is different between cron and an interactive user, but I can't see how just a part of this sending process could fail in this case.
Any suggestions would be much appreciated. Please let me know if any more info would be helpful.
Thanks

AWS push notification not sending | SNS and Pinpoint | Android Studio FCM

I'm unable to receive any of my push notifications sent by either Amazon SNS or Pinpoint. At one point it used to work via the push notification section on AWS however has stopped for some reason. I've tried using pinpoint via a lambda function for it to work but to no avail. I should add also that Pinpoint is my preferred method for sending the push notifications via lambda, as the goal for my project is to have triggered push notifications.
Lambda function using pinpoint to send push notifcation
I'm using Android Studio and I wonder if the problem lies there? as I am using the correct token that my android studio app received so the issue isn't there.
Picture of my token in the android studio
Proof of token used in AWS SNS
Does anyone know what it may be? I would greatly appreciate any help received
Also if anyone knows how to send a notification to all users of my app that would be brilliant.

Twilio throwing error as unreachable destination handset

We are using twilio for sending messages but as Twilio(Text Messaging) integration was shutting down we deployed the integration using cloud run by following steps from https://github.com/GoogleCloudPlatform/dialogflow-integrations/tree/master/twilio#readme
After deployment messages were sending successfully but now suddenly we are getting errors in twilio like
Some messages are sending successfully and for some messages we are getting error.can anybody help me in this.thanks in advance
According to Twillio docs there might be some possible causes for Unreachable destination handset
1.The destination handset you are trying to reach is switched off or otherwise unavailable.
2.The device you are trying to reach does not have sufficient signal
3.The device cannot receive SMS (for example, the phone number belongs to a landline)
4.There is an issue with the mobile carrier
Possible Solutions
The first step to troubleshooting this issue is to attempt to replicate the problems.
Attempt to send another test message to this user via a REST API request, or through the API Explorer in the Twilio Console.

How to remove cloud functions (slack-notification) from a specific cloud build trigger job

I have a cloud function which is configured for slack notification & also have two cloud build trigger against same repository (one is for push activity from git & another one for pull request activity from any branch).
Now when any jobs are getting triggered that cloud function will push the message in slack using pub/sub. But I just want the notification when any process failed or pass activity happen against push activity cloud build trigger, not for the pull request activity trigger. How do I remove the cloud functions for only pull request activity. Can I configure like this?
Thanks in advance. :)
To send the slack notification only according to the build status you can detect the type of the event and choose to send the slack notification or not.
On the event.data variable that you are receiving in the subscribe method you can read the variable status to check the status of the build, so you can send the slack notification only on SUCCESS or FAILURE status.
I do this by adding a substitution variable (either in the build trigger config (UI), or the cloudbuild.yaml itself:
substitutions:
_DISABLE_SLACK: 'true'
Then in your slack webhook code:
// don't send slack messages if we have _DISABLE_SLACK in `cloudbuild.yaml` file -- any value is accepted
if (build && build.substitutions && build.substitutions['_DISABLE_SLACK']) {
return;
}
PS -- I also have another method where you want to disable slack messages for a build, BUT you still want errors... Can post that if you're interested :)
[basically if build.status != 'WORKING', 'QUEUED', 'CANCELLED' && if build.buildTriggerId in [array], then we continue with slack message (overriding DISABLE_SLACK)]