<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Javier Mendoza</title>
    <description>The latest articles on DEV Community by Javier Mendoza (@javiermendogo).</description>
    <link>https://dev.to/javiermendogo</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1009344%2F369cbcd2-273a-40ab-a677-7c06c3171a3a.jpg</url>
      <title>DEV Community: Javier Mendoza</title>
      <link>https://dev.to/javiermendogo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/javiermendogo"/>
    <language>en</language>
    <item>
      <title>Monitoring Third-Party Webhook Delays with AWS Durable Functions</title>
      <dc:creator>Javier Mendoza</dc:creator>
      <pubDate>Wed, 31 Dec 2025 20:49:47 +0000</pubDate>
      <link>https://dev.to/aws-builders/monitoring-third-party-webhook-delays-with-aws-durable-functions-1800</link>
      <guid>https://dev.to/aws-builders/monitoring-third-party-webhook-delays-with-aws-durable-functions-1800</guid>
      <description>&lt;p&gt;In this blog, I'll explain how did we use Durable functions to monitor if delays occurs with the reception of third party webhooks.&lt;/p&gt;

&lt;p&gt;When integrating with external  third-party services, webhook notifications don't always arrive immediately or at all.&lt;/p&gt;

&lt;p&gt;We needed visibility into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whether webhooks actually arrive&lt;/li&gt;
&lt;li&gt;How long they take to reach our system&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The idea was  simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
API GW -&amp;gt; Lambda function which makes a request to third party,  start a Durable Function by sending an event to Eventbridge, and returns the sync response to the user because  the client needed a synchronous response. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwxng430d0b9e0htz22bi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwxng430d0b9e0htz22bi.png" alt=" " width="800" height="389"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2.&lt;br&gt;
Durable Function starts, generate a callbackId, stores the Callback in DynamoDB and waits until a callback is completed. This durable function will allow us to know if the webhook notification ever arrived and if it does how long did it take to land in our system. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n1tjendws8n6lkmb95l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6n1tjendws8n6lkmb95l.png" alt=" " width="800" height="630"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3.&lt;br&gt;
API GW-&amp;gt; SQS -&amp;gt; Webhook handler Lambda.  This webhook handler consumes the Webhook notification from the third party and, gets the callbackId associated and resumes the Durable Function execution.&lt;br&gt;
Having SQS prevent us from having from the race condition scenario where a webhook Notification arrives before the Durable Function has not started. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpo1oq588r4ybw247z9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frpo1oq588r4ybw247z9t.png" alt=" " width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We monitor everything with AWS X-Ray and you can create Cloudwatch Dashboards to monitor how long does it take to arrive on average your notification. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fevumnd7vo2znqfksykzv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fevumnd7vo2znqfksykzv.png" alt=" " width="800" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you so much for the reading. &lt;/p&gt;

</description>
      <category>programming</category>
      <category>lambda</category>
      <category>aws</category>
    </item>
    <item>
      <title>A starters guide from SQS and some learning along the way</title>
      <dc:creator>Javier Mendoza</dc:creator>
      <pubDate>Fri, 14 Nov 2025 22:59:40 +0000</pubDate>
      <link>https://dev.to/javiermendogo/a-starters-guide-from-sqs-and-some-learning-along-the-way-2lpg</link>
      <guid>https://dev.to/javiermendogo/a-starters-guide-from-sqs-and-some-learning-along-the-way-2lpg</guid>
      <description>&lt;p&gt;In this guide, we will go through the basics of what SQS is and why it’s important for you to start using it.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is it?
&lt;/h3&gt;

&lt;p&gt;Is a service from AWS which is queue where messages wait their turn to be processed. &lt;/p&gt;

&lt;p&gt;As a fun fact, SQS was the &lt;a href="https://aws.amazon.com/blogs/aws/amazon_simple_q/" rel="noopener noreferrer"&gt;first Serverless Service launched by AWS in 2006&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Why is it important?
&lt;/h3&gt;

&lt;p&gt;SQS allows you to improve the resilence and retryability of your system. &lt;/p&gt;

&lt;p&gt;Let's imagine that you've the following scenario:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmvsi4osostor8dmu0p2e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmvsi4osostor8dmu0p2e.png" alt=" " width="568" height="230"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your API exposes a POST /create-order endpoint, and it’s connected directly to a Lambda function called 'CreateOrder'.&lt;/p&gt;

&lt;p&gt;If your system receives a lot of traffic, your CreateOrder Lambda may start throttling, which means some orders could be lost.&lt;/p&gt;

&lt;p&gt;In order to avoid this, we can put an SQS in the middle. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhl3ob8vdtfk3cnvbxiwk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhl3ob8vdtfk3cnvbxiwk.png" alt=" " width="800" height="289"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Having the SQS in the middle ensures that requests are not lost.&lt;/p&gt;

&lt;p&gt;The queu will hold each request until it gets consumed or it has reached the maximum age of the message in the queue, by default is 4 days and the maximum is &lt;a href="https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-messages.html#:~:text=By%20default%2C%20a%20message%20is,1%2C209%2C600%20seconds%20(14%20days).&amp;amp;text=Standard%20queues%20support%20a%20very,%2C%20ReceiveMessage%20%2C%20or%20DeleteMessage%20" rel="noopener noreferrer"&gt;14 days&lt;/a&gt;.). &lt;/p&gt;

&lt;p&gt;When a consumer begins processing a message, SQS hides it temporarily so that no other consumer can process it at the same time.&lt;br&gt;
This is controlled by the visibility timeout, which defines how long a message stays hidden while being processed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftz7ot3cvjcx90z5994t2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ftz7ot3cvjcx90z5994t2.png" alt=" " width="800" height="542"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The message is attempted to be consumed up to the amount of times defined by the maxReceiveCount. &lt;br&gt;
This count represents how many attempts the message can go through before being considered “failed.”&lt;/p&gt;
&lt;h3&gt;
  
  
  DLQ
&lt;/h3&gt;

&lt;p&gt;We can setup a Dead-Letter-Queue (DLQ) Attached to our SQS, so that once a message reaches the maxReceiveCount, it is moved to the DLQ for debugging.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4nn8l4bdripp7nxq2cy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fp4nn8l4bdripp7nxq2cy.png" alt=" " width="679" height="420"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a message reaches your DLQ, you can redrive the message to the original queue through the AWS Console or &lt;a href="https://docs.aws.amazon.com/cli/latest/reference/sqs/start-message-move-task.html" rel="noopener noreferrer"&gt;through the CLI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Through the AWS Console:&lt;/p&gt;

&lt;p&gt;You should go to your Queu and select -&amp;gt;&lt;br&gt;
&lt;br&gt;
 &lt;code&gt;Start DLQ Redrive&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs8rnz29uwqg1z706twtq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs8rnz29uwqg1z706twtq.png" alt=" " width="800" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;by default it redrives to the source queu but you can select other queu to the messages to be delivered to. &lt;/p&gt;

&lt;h3&gt;
  
  
  Typical SQS Consumer
&lt;/h3&gt;

&lt;p&gt;We've seen that you can consume SQS by using lambdas, but that's far from the only one. You can also use: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://medium.com/@javierenriquemendozagomez/retry-of-messages-using-amazon-eventbridge-pipes-amazon-sqs-and-aws-step-functions-da0c871362c4" rel="noopener noreferrer"&gt;EventBridge pipes to connect to a state machine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;SNS&lt;/li&gt;
&lt;li&gt;&lt;p&gt;EC2/ECS &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Types of SQS&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are two types of SQS&lt;/p&gt;

&lt;p&gt;Standard SQS where messages may be delivered out of order&lt;/p&gt;

&lt;p&gt;Priority SQS messages are processed in order&lt;/p&gt;

&lt;p&gt;and there are also another type of messages which deserve their own space 'fair queues' which will cover in the next post. &lt;/p&gt;

&lt;p&gt;More to come!&lt;/p&gt;

</description>
      <category>sqs</category>
      <category>aws</category>
      <category>serverless</category>
    </item>
    <item>
      <title>How to reuse variables in your Lambda across invocations and know when it's about to terminate</title>
      <dc:creator>Javier Mendoza</dc:creator>
      <pubDate>Sun, 08 Dec 2024 19:31:19 +0000</pubDate>
      <link>https://dev.to/aws-builders/how-to-reuse-variables-in-your-lambda-across-invocations-and-know-when-its-about-to-terminate-19e6</link>
      <guid>https://dev.to/aws-builders/how-to-reuse-variables-in-your-lambda-across-invocations-and-know-when-its-about-to-terminate-19e6</guid>
      <description>&lt;p&gt;Reader: Why do I need to know this? Can't we just jump straight into the code?&lt;/p&gt;

&lt;p&gt;Writer: Understanding AWS Lambda lifecycles is like learning how to navigate a river. The river flows continuously, with twists, turns, and varying currents. If you don't understand the flow, you might find yourself fighting against it or getting stuck. But if you know how it moves, when it speeds up, slows down, or where it pools.  You can align with it and let it carry you where you need to go.&lt;/p&gt;

&lt;p&gt;Reader: Alright, let's go with your analogy.&lt;/p&gt;

&lt;p&gt;Writer: Here it is! the Lambda execution environment lifecycle&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq6lb3wpfuzquecktdys9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq6lb3wpfuzquecktdys9.png" alt="Image description" width="800" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Reader: Woooow, I always wanted to read the official docs paraphrased by a junior dev. &lt;/p&gt;

&lt;p&gt;Writer: &lt;em&gt;Ignoring the jab&lt;/em&gt; Let me explain the lifecycle in simple terms.&lt;/p&gt;

&lt;h1&gt;
  
  
  The Init Phase and Variable Reuse
&lt;/h1&gt;

&lt;p&gt;The init phase occurs only during a cold start. When a new Lambda execution environment is created. During this phase the lambda performs 3 tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Starts up extensions&lt;/li&gt;
&lt;li&gt;Sets up the runtime&lt;/li&gt;
&lt;li&gt;Runs any initialization code placed outside the handler function&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This initialization is important because the variables and resources you set up here can be reused across multiple function invocations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Caching&lt;/strong&gt;&lt;br&gt;
In the code below, we store a token at the module level. The first time the Lambda environment is created, we fetch the token and save it. On subsequent invocations (warm starts), we simply reuse the token, saving time and resources.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Token&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nx"&gt;Token&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Reusing Token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Generating Token&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getTokenFromThirdPartyAPI&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;myToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getToken&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="c1"&gt;// Use myToken as needed&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;More use cases&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In Jeremy Daly’s blog, he shows how declaring variables outside the handler enables you to &lt;a href="https://www.jeremydaly.com/reuse-database-connections-aws-lambda/" rel="noopener noreferrer"&gt;reuse database connections across multiple invocations&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;AWS Powertools for TypeScript: &lt;a href="https://docs.powertools.aws.dev/lambda/typescript/latest/utilities/parameters/" rel="noopener noreferrer"&gt;The AWS Powertools Parameters &lt;/a&gt; utility uses the same approach.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://github.com/aws-powertools/powertools-lambda-typescript/blob/3357b306505db54df7bd264af7fec4fbfc2c2527/packages/parameters/src/base/DefaultProviders.ts#L4" rel="noopener noreferrer"&gt;Declaration of variable at the runtime level&lt;br&gt;
&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="p"&gt;...&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;DEFAULT_PROVIDERS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;BaseProviderInterface&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
&lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/packages/parameters/src/secrets/getSecret.ts#L109" rel="noopener noreferrer"&gt;Application of the singleton Pattern to reuse the variable if it has not already initialized&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getSecret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hasOwn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;DEFAULT_PROVIDERS&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secrets&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;DEFAULT_PROVIDERS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;secrets&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SecretsProvider&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;DEFAULT_PROVIDERS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;secrets&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;SecretsProvider&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;options&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Usage inside the handler&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;getSecret&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@aws-lambda-powertools/parameters/secrets&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Retrieve a secret, cached for 1 hour.&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;secret&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;getSecret&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;my-secret&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;maxAge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;secret&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  The Invoke Phase
&lt;/h1&gt;

&lt;p&gt;The invoke phase is what happens every time your Lambda function is called(if it did not failed in the Init phase). This runs inside the handler function&lt;/p&gt;

&lt;h1&gt;
  
  
  The shutdown phase and how to know when your lambda is terminating
&lt;/h1&gt;

&lt;p&gt;When the Lambda environment is about to be terminated, there’s a shutdown phase. If you have registered external or internal extensions, AWS will send a SIGTERM signal, giving you about 300ms (or 500ms for internal extensions) to gracefully shut down.&lt;/p&gt;

&lt;p&gt;You can use any extension, in my case for the following example I've decided to use the &lt;a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Lambda-Insights.html" rel="noopener noreferrer"&gt;Cloudwatch Lambda Insights Extensions&lt;/a&gt;, this extension allows you to get more data of your metrics and logs of a function.&lt;/p&gt;

&lt;p&gt;In your CDK app&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="c1"&gt;/// In your CDK App &lt;/span&gt;
&lt;span class="p"&gt;....&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;dummyFunction&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;NodejsFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;dummyFunction&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./src/sendAppleSessionRequest.ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="na"&gt;insightsVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;LambdaInsightsVersion&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;VERSION_1_0_333_0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;// Setup of Lambda Insights extension&lt;/span&gt;
    &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="p"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In your Lambda&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SIGTERM&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Terminating Lambda&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// Close connections&lt;/span&gt;
  &lt;span class="c1"&gt;// Close any open resources&lt;/span&gt;
  &lt;span class="c1"&gt;// Close DB connections&lt;/span&gt;
  &lt;span class="c1"&gt;// Terminate any ongoing processes&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Starting lambda&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if you combine it with the power of reuse variables from the runtime you can get something pretty cool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;SIGTERM&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Terminating Lambda&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Closing connection&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;isConnectionInitialized&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;initializeConnection&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;isConnectionInitialized&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Initializing connection&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nx"&gt;isConnectionInitialized&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Connection already initialized&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;any&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Starting Lambda&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;initializeConnection&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;p&gt;AWS Lambda functions run through three main phases: init, invoke, and shutdown.&lt;br&gt;
By setting up and reusing variables during init, you save time and resources during each invocation.&lt;br&gt;
With a graceful shutdown, you ensure everything wraps up cleanly before the next run.&lt;/p&gt;

&lt;h2&gt;
  
  
  Recommended reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.jeremydaly.com/reuse-database-connections-aws-lambda/" rel="noopener noreferrer"&gt;Reuse of DB Connections by Jeremy Daly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://medium.com/r?url=https%3A%2F%2Fgithub.com%2Faws-samples%2Fgraceful-shutdown-with-aws-lambda%2Ftree%2Fmain" rel="noopener noreferrer"&gt;Gracefully shutting down of a Lambda&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/paulswail/async-initialisation-of-a-lambda-handler-2bc"&gt;Async initialization of a Lambda Handler by Paul Swail&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>lambda</category>
      <category>lifecycle</category>
      <category>aws</category>
      <category>serverless</category>
    </item>
    <item>
      <title>Retry of Messages Using Amazon EventBridge Pipes, Amazon SQS, And AWS Step Functions</title>
      <dc:creator>Javier Mendoza</dc:creator>
      <pubDate>Mon, 16 Jan 2023 19:21:29 +0000</pubDate>
      <link>https://dev.to/javiermendogo/retry-of-messages-using-amazon-eventbridge-pipes-amazon-sqs-and-aws-step-functions-355d</link>
      <guid>https://dev.to/javiermendogo/retry-of-messages-using-amazon-eventbridge-pipes-amazon-sqs-and-aws-step-functions-355d</guid>
      <description>&lt;p&gt;Amazon Eventbridge Pipes was launched on the last re: invent 2022. Amazon EventBridge Pipes allows you to glue different AWS services and optionally filter or enrich the structure of the events passed from consumers to producers.&lt;/p&gt;

&lt;p&gt;You can use an SQS queue as a source of the Amazon EventBridge Pipe and an AWS Step Function as a target.&lt;/p&gt;

&lt;p&gt;I attached a DLQ to the SQS source, &lt;a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-pipes-error-troubleshooting.html" rel="noopener noreferrer"&gt;but reading the documentation it was not clear to me when the message was going to be sent to the DLQ&lt;/a&gt;, so I decide to give it a try myself.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Futdhiqn6zykgr05jamhn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Futdhiqn6zykgr05jamhn.png" alt="Image description" width="800" height="517"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the Amazon EventBridge Pipe is created with a State Machine as a target, it is required to &lt;a href="https://docs.aws.amazon.com/eventbridge/latest/pipes-reference/API_PipeTargetStateMachineParameters.html#eventbridge-Type-PipeTargetStateMachineParameters-InvocationType" rel="noopener noreferrer"&gt;set the type of Invocation as FIRE_AND_FORGET or REQUEST_RESPONSE.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Standard workflows
&lt;/h3&gt;

&lt;p&gt;For Standard workflows, the only type of Invocation allowed is the FIRE_AND_FORGET which means that&lt;a href="https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-pipes.html#pipes-invocation" rel="noopener noreferrer"&gt; EventBridge doesn’t wait for a response before proceeding&lt;/a&gt;. I set up a Standard Workflow with a Lambda which throw an error when it was invoked.&lt;/p&gt;

&lt;p&gt;The Standard Workflow was failing, but the Amazon EventBridge Pipe was not aware of the executions and counted each one of the invocations as successful. I polled the messages of the DLQ over various minutes through the AWS Console, but the DLQ did not have any messages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskzvgb4qpl4bny0a7y73.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fskzvgb4qpl4bny0a7y73.png" width="800" height="270"&gt;&lt;/a&gt;&lt;br&gt;The workflow was failing
  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F40xtfyz301gknsxhvwyl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F40xtfyz301gknsxhvwyl.png" width="800" height="324"&gt;&lt;/a&gt;&lt;br&gt;But no Executions errors appeared on the Pipe&lt;br&gt;

  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh79b6cupot47obis4a2f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh79b6cupot47obis4a2f.png" width="800" height="224"&gt;&lt;/a&gt;&lt;br&gt;The DLQ was empty&lt;br&gt;

  &lt;/p&gt;

&lt;h3&gt;
  
  
  Express workflows
&lt;/h3&gt;

&lt;p&gt;For the test with an Express workflow, I set up the workflow as invocation type REQUEST_RESPONSE. The Amazon EventBridge Pipe this time was aware of the FailedExecutions and it did not take too much time until the messages started appearing in the DLQ. This means that the failed messages were able to be re-driven to the original source queue.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2vkspsds725js12faudt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2vkspsds725js12faudt.png" width="800" height="331"&gt;&lt;/a&gt;&lt;br&gt;The EventBridgePipe showed the Failed Executions for Express workflows&lt;br&gt;

  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faqpo19tsloqcmdgkmdix.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faqpo19tsloqcmdgkmdix.png" width="800" height="325"&gt;&lt;/a&gt;&lt;br&gt;The messages started appearing in the DLQ&lt;br&gt;

  &lt;/p&gt;

&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;A message will never arrive in the DLQ attached to an SQS if we use SQS as a source of the Amazon EventBridge Pipes and a Standard Workflow as a target.&lt;/p&gt;

&lt;p&gt;Hopefully in the future, the EventBridge team will make this possible. &lt;a href="https://youtu.be/RfvL_423a-I?t=3" rel="noopener noreferrer"&gt;But nowadays this does not help in the evolution to an asynchronous world.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>development</category>
      <category>productivity</category>
      <category>tooling</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
