<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ AWS Step Functions - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ AWS Step Functions - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Wed, 24 Jun 2026 20:19:32 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/aws-step-functions/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Building a community sign-up app with Serverless, StepFunctions, and StackStorm Exchange — Episode… ]]>
                </title>
                <description>
                    <![CDATA[ By Dmitri Zimine Build a real-world serverless application on AWS with Serverless framework and ready-to-use functions from StackStorm Exchange open-source catalog. Episode One | Episode Two | Episode Three | Episode Four It took us three exciting ep... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/building-a-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-7c5f0e93dd6/</link>
                <guid isPermaLink="false">66c3468eec912a556094db94</guid>
                
                    <category>
                        <![CDATA[ aws lambda ]]>
                    </category>
                
                    <category>
                        <![CDATA[ AWS Step Functions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Devops ]]>
                    </category>
                
                    <category>
                        <![CDATA[ FaaS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ serverless ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 03 Jan 2018 02:03:56 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*jiZOQLvfX2257LHxe3n4cg.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Dmitri Zimine</p>
<p>Build a real-world serverless application on AWS with <a target="_blank" href="https://serverless.com/framework/">Serverless framework</a> and ready-to-use functions from <a target="_blank" href="https://exchange.stackstorm.org">StackStorm Exchange</a> open-source catalog.</p>
<p><a target="_blank" href="https://medium.com/@dzimine/tutorial-building-a-community-on-boarding-app-with-serverless-stepfunctions-and-stackstorm-b2f7cf2cc419">Episode One</a> | <a target="_blank" href="https://medium.com/@dzimine/building-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-2-b1efeb1b9bd6">Episode Two</a> | <a target="_blank" href="https://medium.com/@dzimine/building-a-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-6efb9c102b0a">Episode Three</a> | Episode Four</p>
<p>It took us three exciting episodes to create a non-trivial serverless app. The back-end now works, but two things are still missing: a Web UI, and a final discussion to sum up the lessons. Let’s continue… after a quick recap of the previous episodes:</p>
<ul>
<li>In <a target="_blank" href="https://medium.com/@dzimine/tutorial-building-a-community-on-boarding-app-with-serverless-stepfunctions-and-stackstorm-b2f7cf2cc419">Episode One</a>, I described the application we are building, walked you through setting up the development environment and creating a Serverless project, and showed how to build your first Lambda function from a <a target="_blank" href="https://exchange.stackstorm.org">StackStorm Exchange</a> action with <a target="_blank" href="https://serverless.com/framework">Serverless Framework</a>.</li>
<li>In <a target="_blank" href="https://medium.com/@dzimine/building-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-2-b1efeb1b9bd6">Episode Two</a>, we added more actions: one native Lambda to record user info to DynamoDB, and another one from StackStorm Exchange to make a call to ActiveCampaign CRM system. You learned more of <code>serverless.yml</code>syntax and practiced the development workflow with Lambda functions.</li>
<li>In <a target="_blank" href="https://medium.com/@dzimine/building-a-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-6efb9c102b0a">Episode Three</a>, we wired the actions with StepFunctions, learned tricks on passing the data between the steps, struggled debugging StepFunction executions, and finally got the backend working end-to-end.</li>
</ul>
<p>You can get the final code for this episode from <a target="_blank" href="https://github.com/dzimine/slack-signup-serverless-stormless/tree/DZ/3-add-stepfunction">GitHub</a>.</p>
<h3 id="heading-add-web-ui">Add Web UI</h3>
<p>We need a web form that takes user names and emails, and posts to our StepFunction API Gateway endpoint. I just copied the one I used while <a target="_blank" href="https://github.com/dzimine/slack-signup-serverless">exploring Serverless with Python, StepFunctions, and Web Front-end Serverless</a>. Which, I confess, I grabbed from the old <a target="_blank" href="https://github.com/serverless-london/serverless-slack-invite">Serverless Slack Invite</a> project.</p>
<p>Those of you who are Web developers can surely create something more elegant with ReactJS — PRs welcome! Whether you build your own or grab mine, do this: create a directory <code>web</code> and place the static content there.</p>
<p>I use <code>[http-server](https://www.npmjs.com/package/http-server)</code> for a quick look that at my static form:</p>
<pre><code>cd webhttp-serverStarting up http-server, serving ./Available on:  http:<span class="hljs-comment">//127.0.0.1:8080</span>
</code></pre><p>Open a browser, check the form at <a target="_blank" href="http://127.0.0.1:8080">http://127.0.0.1:8080</a> , see that it comes out right, and let’s move on to the next step.</p>
<p>How is a serverless web front end deployed to AWS? Typically, you put the static content on S3, configure it to serve the web, make your web app call your backend endpoint, and remember to enable CORS on API Gateway endpoint.</p>
<p>Alternatively, you add a path to your API Gateway resource to serve your static web content from the S3 bucket.</p>
<p><strong>Pros:</strong> 1) no mess with CORS, 2) no adjusting your web app to point to the correct backend endpoint. Extra bonus: easily done with <a target="_blank" href="https://github.com/sdd/serverless-apig-s3">serverless-apig-s3</a> plugin.</p>
<p><strong>Cons:</strong> 1) paying API Gateway charges for web requests 2) the plugin is a bit shaky: fine for examples and small apps, but I wouldn’t use it for anything resembling production.</p>
<p><strong>PRO TIP:</strong> For serious web front-ends with high loads: deploy them to CloudFront. Or use something like Netlify — check out the recent post <a target="_blank" href="https://serverless.com/blog/how-built-static-serverless-website-netlify/">“How to build a static Serverless site with Netlify”</a> from serverless.com.</p>
<p>I’ll use the API Gateway approach with <a target="_blank" href="https://github.com/sdd/serverless-apig-s3">serverless-apig-s3</a> plugin here: we don’t expect massive load. And it is simple. Watch:</p>
<p>Install the plugin (been there, done that):</p>
<pre><code>npm install --save-dev serverless-apig-s3
</code></pre><p>Change <code>serverless.yml</code>. Add the plugin (been there, done that). Add the <a target="_blank" href="https://github.com/sdd/serverless-apig-s3">plugin’s configurations</a>:</p>
<pre><code>...custom:  private: ${file(env.yml):private}  stage: ${<span class="hljs-attr">opt</span>:stage, <span class="hljs-attr">self</span>:provider.stage}  region: ${<span class="hljs-attr">opt</span>:region, <span class="hljs-attr">self</span>:provider.region}  apigs3:    dist: web    topFiles: <span class="hljs-literal">true</span>
</code></pre><pre><code>...
</code></pre><pre><code>plugins:  - serverless-plugin-stackstorm  - serverless-step-functions  - serverless-apig-s3
</code></pre><p>We are telling the plugin to pick our <code>web</code> directory and put it to S3. The <code>topFiles</code> flag tells API Gateway to expose our <code>index.html</code> and <code>formsubmit.js</code> at our endpoint, under <code>/web/</code></p>
<p>Now deploy the service, and, separately, the client side, with two commands:</p>
<pre><code>sls deploy
</code></pre><pre><code>sls client deploy
</code></pre><p>Deploying the service will update the API Gateway with the paths to access our web content. Deploying the client puts the web content up to an S3 bucket. Now you can reason that if you add or remove web files and client deploy is not enough, a full <code>sls deploy</code> is required. But if you only change the web files, quick <code>sls client deploy</code> will put them up on AWS.</p>
<p>That’s it!<br>Go to <code>https://YOUR-ENDPOINT.amazonaws.com/dev/web/index.html.</code>The form is right there. The button is orange. You type in the user info and email, hit the orange button. The green message tells you everything is OK. Soon you receive an invitation from Slack. You check the StepFunction executions in AWS console and see everything is green.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/P7X4oec6ilXzVayCaauhg-KqdJAwkcRIMI1w" alt="Image" width="543" height="328" loading="lazy"></p>
<p><strong>No?!</strong> Most likely, you hit this <a target="_blank" href="https://github.com/sdd/serverless-apig-s3/issues/16">apig-s3 bug</a>, just like I did. And just like I did, you got to do a little final step manually.</p>
<p>Open AWS Console -&gt;API Gateway-&gt;Resources-&gt;Actions-Deploy API.<br>Or use AWS CLI:</p>
<pre><code># Find out your rest-api-id firstaws apigateway get-rest-apis
</code></pre><pre><code># Deploy the changes to the stage# Don<span class="hljs-string">'t COPY-PASTE, it needs YOUR ID!aws apigateway create-deployment --rest-api-id  YOUR_API_ID  --stage-name dev</span>
</code></pre><p><strong>Now it works for me.</strong></p>
<p><strong>PRO TIP:</strong> The plugin works when everything is deployed from scratch. But if you’re tempted to <code>sls remove</code> and redeploy again, you hit at least one <a target="_blank" href="https://github.com/sdd/serverless-apig-s3/issues/11">other plugin bug</a> on removing the stack. See Tips and Tricks at the end of the post on how to properly clean-up.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/AxHuvaj3Gp0QWiqDinSqS43JfK1RsrcQJsVw" alt="Image" width="800" height="396" loading="lazy"></p>
<p>Congratulations! You made it. You might have followed along and built your own app. You might have dropped it at some point out of frustration or fatigue. You might have just skimmed the text and examples. But if you made it to the end, you learned enough of serverless to be dangerous.</p>
<h3 id="heading-reflection">Reflection</h3>
<p>After wrestling through all the 4 episodes, you likely sensed it: serverless is not simple. Many things can go wrong as you build a serverless app.</p>
<p>You can blame some on me: I surely made a few mistakes and omissions (BTW reports and comments much appreciated!)</p>
<p>But serverless complexity is not all my fault. We wire together many different services — AWS and 3rd party — with many different wires — frameworks and tools. The services are of different quality and [in]convenience (don’t get me started on AWS StepFunction CLI). The frameworks and tools are still maturing (which serverless plugin made you struggle the most?).</p>
<p>Why get into serverless? Because for some classes of apps, it is substantially cheaper. This community signup is a case in point: we used to run StackStorm’s with StackStorm. It was simple to build and solid like a rock, but it took a <code>m3.large</code> instance at $100/month, without even getting to multi-zone reliability. With serverless it runs at less than $1/month, thanks to the occasional load pattern. $100 would buy us ~5,000,000 sign-ups — that’s more that we’ll ever need!</p>
<p>On the other extreme, high volume apps with high reliability requirements might be better as serverless too, leveraging “infinite” elasticity which may be expensive to build and operate yourself. I carefully use “<em>might</em>” and “<em>would</em>”, as the equation varies greatly from case to case. Do your math upfront, watch your load patterns, explore your bill.</p>
<p>As for taming complexity, <a target="_blank" href="https://serverless.com/framework">Serverless framework</a> helps. To fully appreciate it, try and redo the same app without it. Make it reliable, repeatable, reviewable infrastructure-as-code. While Serverless framework is not the only game in town, I specifically like it for it’s pluggable architecture and the plugin ecosystem.</p>
<p>Plugins help, picking up in areas not covered by the core Serverless framework. Using the plugins, we enjoyed the simplicity of building StepFuncions and adding simple web front-ends (and if you haven’t, try and redo it without the plugins). There are more: skim and bookmark the <a target="_blank" href="https://github.com/serverless/plugins">list of official plugins</a> to keep them in mind when for your next project.</p>
<p><a target="_blank" href="https://exchange.stackstorm.org">StackStorm Exchange</a> — the recent addition to the serverless ecosystem — brings a catalog of reusable integrations. While it is not hard to scrape APIs for ActiveCampaign or find and use undocumented Slack API calls, it is low-value work that takes away from building the application logic.</p>
<p>Explore what is already there: while DevOps integrations dominate due to StackStorm roots in IT automation, I expect that variety will grow now that Serverless community is joining to contribute and co-pilot the catalog.</p>
<p>With that, <strong>we are officially done.</strong> Enjoy!</p>
<h3 id="heading-a-few-more-tips-and-tricks">A few more Tips and Tricks</h3>
<ul>
<li>Removing everything will not remove the DynamoDB table. A reasonable default, but when you try and re-deploy the service, it’ll cry that the table can’t be created as it already exists. Delete it: <code>aws dynamodb delete-table --table-name signup-stormless-dev</code></li>
<li>Due to an apig-s3 bug, <code>sls remove</code> will fail complaining that the bucket is not empty. Remove the web s3 bucket manually when removing a stack. <code>aws s3 rb s3://bucketname --force</code></li>
<li>Removing the stack does not remove the DynamoDB table. If you really want to start from scratch, delete it manually (export the data first):<br><code>aws dynamodb delete-table --table-name slack-signup-dev</code></li>
<li>Sometimes <code>sls delete</code> fails to clean up. Reasons might be various, but the place to look is the same. Did I tell you to master CloudFormation? Go there, find a stack that failed to delete, find the reason, fix, and delete the stack.</li>
</ul>
<p>Hope this helped you learn something new, find something interesting, or provoked some good thoughts. Please share your thoughts in the comments here, or tweet me <a target="_blank" href="https://twitter.com/dzimine">@dzimine</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Building a community sign-up app with Serverless, StepFunctions, and StackStorm Exchange — Episode… ]]>
                </title>
                <description>
                    <![CDATA[ By Dmitri Zimine Build a real-world serverless application on AWS with Serverless framework and ready-to-use functions from StackStorm Exchange open-source catalog. Episode One | Episode Two | Episode Three | Episode Four We are at Episode Three. Qui... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/building-a-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-6efb9c102b0a/</link>
                <guid isPermaLink="false">66c3468c160da468ed76f16f</guid>
                
                    <category>
                        <![CDATA[ AWS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ aws lambda ]]>
                    </category>
                
                    <category>
                        <![CDATA[ AWS Step Functions ]]>
                    </category>
                
                    <category>
                        <![CDATA[ FaaS ]]>
                    </category>
                
                    <category>
                        <![CDATA[ serverless ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 21 Dec 2017 07:06:59 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*0xq8ywxkBv-oIe6b-6H9ug.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Dmitri Zimine</p>
<p>Build a real-world serverless application on AWS with <a target="_blank" href="https://serverless.com/framework/">Serverless framework</a> and ready-to-use functions from <a target="_blank" href="https://exchange.stackstorm.org">StackStorm Exchange</a> open-source catalog.</p>
<p><a target="_blank" href="https://medium.com/@dzimine/tutorial-building-a-community-on-boarding-app-with-serverless-stepfunctions-and-stackstorm-b2f7cf2cc419">Episode One</a> | <a target="_blank" href="https://medium.com/@dzimine/building-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-2-b1efeb1b9bd6">Episode Two</a> | Episode Three | <a target="_blank" href="https://medium.com/@dzimine/building-a-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-7c5f0e93dd6">Episode Four</a></p>
<p>We are at Episode Three. Quick recap:</p>
<ul>
<li>In <a target="_blank" href="https://medium.com/@dzimine/tutorial-building-a-community-on-boarding-app-with-serverless-stepfunctions-and-stackstorm-b2f7cf2cc419">Episode One</a>, I described the application we are building, walked you through setting up the development environment and creating a Serverless project, and showed how to build your first Lambda function from a <a target="_blank" href="https://exchange.stackstorm.org">StackStorm Exchange</a> action with <a target="_blank" href="https://serverless.com/framework">Serverless Framework</a>.</li>
<li>In <a target="_blank" href="https://medium.com/@dzimine/building-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-2-b1efeb1b9bd6">Episode Two</a>, we added more actions: one native Lambda to record user info to DynamoDB, and another one from StackStorm Exchange to make a call to ActiveCampaign CRM system. You learned more of <code>serverless.yml</code> syntax and practiced the development workflow with Lambda functions.</li>
</ul>
<p>In this third episode, I’ll show how to use AWS StepFunction to wire the actions into a workflow.</p>
<p>You can get the final code for this episode from <a target="_blank" href="https://github.com/dzimine/slack-signup-serverless-stormless/tree/DZ/3-add-stepfunction">GitHub</a>.</p>
<h3 id="heading-wiring-functions-together-with-stepfunction">Wiring functions together with StepFunction</h3>
<p>Now that our building blocks — Lambda functions — are all lined up, it’s time to string them together. An <a target="_blank" href="https://aws.amazon.com/step-functions/">AWS StepFunction</a> will define the sequence of calls, maintain the state of the sign-up workflow, and carry the data between the steps. I’ll use the<code>[serverless-step-functions](https://github.com/horike37/serverless-step-functions)</code> plugin from Serverless Champion @horike37, give him a heart:</p>
<p>Let’s get busy. Install the plugin:</p>
<pre><code>npm install --save-dev serverless-step-functions
</code></pre><p>Add the plugin to the <code>serverless.yml</code> file:</p>
<pre><code>plugins:  - serverless-plugin-stackstorm  - serverless-step-functions
</code></pre><p>The Step Function definition will require my <code>accountID</code>. As it is something I want to keep to myself, I add it to <code>env.yml</code>, which now looks like this:</p>
<pre><code># ./env.yml# Don<span class="hljs-string">'t commit to Github :)</span>
</code></pre><pre><code>slack:  admin_token: <span class="hljs-string">"xoxs-111111111111-..."</span>  organization: <span class="hljs-string">"your-team"</span>active_campaign:  url: <span class="hljs-string">"https://YOUR-COMPANY.api-us1.com"</span>  api_key: <span class="hljs-string">"1234567a9012a12345z12aa2aaa..."</span>private:  accountId: <span class="hljs-string">"000000000000"</span>
</code></pre><p>Go back to <code>serverless.yml</code> and add the following two blocks:</p>
<pre><code># ./serverless.yml......custom:  private: ${file(env.yml):private}  stage: ${<span class="hljs-attr">opt</span>:stage, <span class="hljs-attr">self</span>:provider.stage}  region: ${<span class="hljs-attr">opt</span>:region, <span class="hljs-attr">self</span>:provider.region}
</code></pre><pre><code>stepFunctions:  stateMachines:    signup:      events:        - http:            path: signup            method: POST            cors: <span class="hljs-literal">true</span>      definition: ${file(stepfunction.yml)}
</code></pre><p>In the <code>custom</code> block, I assigned the <code>private</code> object from the <code>private</code> key in <code>env.yml</code>. I also defined variables for <code>stage</code> and <code>region</code> so that the values are picked from CLI options, if provided, or default to the current AWS settings.</p>
<p>The <code>stepFunctions</code> block is here to define - you have already guessed - StepFunctions. Mine is called "<code>signup</code>".</p>
<p>The <code>events</code> section here is doing exactly what <code>events</code> sections do in function definitions: it configures an API Gateway endpoint for invoking StepFunction from outside of AWS. We'll use it later to call the back-end from a Web form.</p>
<p>The <code>definition</code> can be written as YAML right here in <code>serverless.yml</code>, but I prefer to include it from a separate file, keeping the logic separate from the configuration. Here it is:</p>
<p>StepFunction definitions are written in <a target="_blank" href="https://states-language.net/spec.html">Amazon States Language</a>. The spec is short, well written and worth a read. Using YAML instead of JSON is a nice perk from the plugin — it reads better and allows comments. But if you want JSON — no problem, help yourself.</p>
<ul>
<li><code>Resource</code> refers to Lambda functions by ARN. I used the variables we defined earlier to construct the ARNs matching account ID, region, and stage with the function name: <code>arn:aws:lambda:${self:custom.region}:${self:custom.private.accountId}:function:${self:service}-${self:custom.stage}-RecordDB</code></li>
<li><code>ResultPath</code> is used to pass data between steps. By default, StepFunctions work on a "need-to-know" basis: the step downstream receives only the output from the step directly upstream. If you think it logical, think again: if only RecordDB receives the workflow input, how will RecordAC and InviteSlack get it? RecordDB may just return "200 OK", not <code>email</code>. Changing the code of functions to return their input would make them <a target="_blank" href="https://refactoring.guru/smells/inappropriate-intimacy">inappropriately intimate</a>. The trick is to use <code>ResultPath</code> to write the function output under a function-specific key, like <code>ResultPath: $results.RecordDB</code>. This preserves initial workflow input in the step output for downstream Lambda steps, while appending the output of each Lambda. Like this:</li>
</ul>
<pre><code>{  <span class="hljs-string">"body"</span>: {    <span class="hljs-string">"name"</span>: <span class="hljs-string">"Vasili Terkin"</span>,    <span class="hljs-string">"email"</span>: <span class="hljs-string">"dmitri.zimine+terkin@gmail.com"</span>,    <span class="hljs-string">"first_name"</span>: <span class="hljs-string">"Vasili"</span>,    <span class="hljs-string">"last_name"</span>: <span class="hljs-string">"Terkin"</span>  },  <span class="hljs-string">"results"</span>: {    <span class="hljs-string">"RecordDB"</span>: {      <span class="hljs-string">"statusCode"</span>: <span class="hljs-number">200</span>    },    <span class="hljs-string">"RecordAC"</span>: ...    ...  }}
</code></pre><p>To fully grasp it, read the <a target="_blank" href="https://states-language.net/spec.html#filters">“Input and Output” section</a> in the spec. Ansd entertain youself with a video from “<a target="_blank" href="https://foobar123.com/aws-step-functions-tutorial-76b9f5a7b9c8">AWS Step Functions Tutorial</a>” by <a target="_blank" href="https://www.freecodecamp.org/news/building-a-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-6efb9c102b0a/undefined">Marcia Villalba</a>.</p>
<p><strong>PRO TIP:</strong> I made the workflow sequential to demonstrate the data passing trick. It is more proper to run all three steps in parallel: it is faster and more resilient: the failure of one step will not prevent the other function invocations. Go ahead change the StepFunctions to parallel.</p>
<p>That is it. Time to try. Deploy, invoke, check the logs.</p>
<p>You CURL fans know what to do with the new API Gateway endpoint for our StepFunction. If you forgot the endpoint, <code>sls info</code> to the rescue. I’ll show off again with <a target="_blank" href="https://httpie.org">httpie</a>:</p>
<pre><code># DON<span class="hljs-string">'T COPY! Use YOUR ENDPOINT!</span>
</code></pre><pre><code>http POST https:<span class="hljs-comment">//YOUR.ENDPOINT.amazonaws.com/dev/signup \body:='{"email":"santa@mad.russian.xmas.com", "first_name":"Santa", "last_name": "Claus"}'</span>
</code></pre><p>Ok, <code>http</code> or <code>curl</code>, either way it returns the StepFunction execution ARN so that we can check on it to see how our StepFunction is being executed. How do we check on it? I’m afraid you gotta open a browser and login to your AWS Console. If you want to use AWS CLI first, fine, don’t say I didn’t show you how:</p>
<pre><code>aws stepfunctions describe-execution --execution-arn arn:aws:states:us-east<span class="hljs-number">-1</span>:<span class="hljs-number">00000000000</span>:execution:SignupStepFunctionsStateMac-seo9CrijATLU:cbeda709-e530<span class="hljs-number">-11e7</span><span class="hljs-number">-86</span>d3<span class="hljs-number">-49</span>cbe4261318 --output json{    <span class="hljs-string">"status"</span>: <span class="hljs-string">"FAILED"</span>,     <span class="hljs-string">"startDate"</span>: <span class="hljs-number">1513738340.18</span>,     <span class="hljs-string">"name"</span>: <span class="hljs-string">"cbeda709-e530-11e7-86d3-49cbe4261318"</span>,     <span class="hljs-string">"executionArn"</span>: <span class="hljs-string">"arn:aws:states:us-east-1:00000000000:execution:SignupStepFunctionsStateMac-seo9CrijATLU:cbeda709-e530-11e7-86d3-49cbe4261318"</span>,     <span class="hljs-string">"stateMachineArn"</span>: <span class="hljs-string">"arn:aws:states:us-east-1:00000000000:stateMachine:SignupStepFunctionsStateMac-seo9CrijATLU"</span>,     <span class="hljs-string">"stopDate"</span>: <span class="hljs-number">1513738370.481</span>,     <span class="hljs-string">"input"</span>: <span class="hljs-string">"{\"body\":{\"email\":\"santa@mad.russian.xmas.com\",\"first_name\":\"Santa\",\"last_name\":\"Claus\"}}"</span>}
</code></pre><p>This is the output for an execution that failed because the RecordAC function timed out. Can you infer this from the output? The only valuable info here is <code>FAILED</code>. No kidding! I must say AWS don't give StepFunction the love it deserves. Not in CLI. If you think I missed something, check <a target="_blank" href="http://docs.aws.amazon.com/cli/latest/reference/stepfunctions/index.html">the CLI docs</a>, find it and tell me.</p>
<p>The most irritating part is that the CLI doesn’t tell me which step failed. They make me call the logs on every Lambda, one by one. Luckily I only have 3 functions, what if there were more?</p>
<p>Or, open a browser and hop on AWS Console.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1*0xq8ywxkBv-oIe6b-6H9ug.png" alt="Image" width="800" height="409" loading="lazy"></p>
<p>Even there, debugging some Lambda failures, like timeouts, is tricky. StepFunction execution “Exception” report says <code>"The cause could not be determined because Lambda did not return an error type."</code>Go to the lambda logs to see what happened there.</p>
<p>There I find the line which I wish I saw in the StepFunction exception:</p>
<pre><code><span class="hljs-number">2017</span><span class="hljs-number">-12</span><span class="hljs-number">-20</span>T04:<span class="hljs-number">21</span>:<span class="hljs-number">44.298</span>Z <span class="hljs-number">4230</span>a73b-e53d<span class="hljs-number">-11e7</span>-be6b-bff82b9b3572 Task timed out after <span class="hljs-number">6.00</span> seconds
</code></pre><p><strong>PRO TIP:</strong> For debugging, invoke the StepFunction with <code>sls invoke stepf</code>: it creates the execution, waits for completion, and prints the output to the terminal. Three AWS CLI commands in one.</p>
<pre><code>sls invoke stepf --name signup \--data  <span class="hljs-string">'{"body": {"email":"santa@mad.russian.xmas.com", "first_name":"Santa", "last_name": "Clause"}}'</span>
</code></pre><p>Your StepFunction executions may work just fine — we already adjusted the timeouts. I took you on this debugging detour for a taste of StepFunction troubleshooting, admittedly a bit bitter. On the sweet side, once debugged, StepFunctions run reliably like Toyota cars.</p>
<p>As a back-end developer, I am tempted to call it done here. But to make it a<br>“complete example” we need one more thing. <strong>The Web front-end.</strong></p>
<p>Let’s call it a day and save the web part and conclusions for the next and final episode.</p>
<p><a target="_blank" href="https://medium.com/@dzimine/building-a-community-sign-up-app-with-serverless-stepfunctions-and-stackstorm-exchange-episode-7c5f0e93dd6"><strong>Episode 4</strong></a><strong>: Adding Web Front-end, Reflection and Summary</strong></p>
<p>Hope this helped you learn something new, find something interesting, or provoked some good thoughts. Please share your thoughts in the comments here, or tweet me <a target="_blank" href="https://twitter.com/dzimine">@dzimine</a>.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
