Serverless Environment Variables – A Comprehensive Guide

You build Serverless applications. You know that you should use environment variables instead of putting things like secrets, configurations, and environment-specific logic in your application code, because you follow the 12-Factor App Methodology. But configuring Serverless environment variables for projects is a pain. What if it was not a pain? What if you had a straightforward way to configure...

Updating Dynamic Maps in Elixir

Maps are used extensively in Elixir. Updating nested maps in Elixir is straightforward if you already know the structure of your map beforehand (in this case, you may want to use a Struct instead). But updating dynamic maps in Elixir, especially if they are nested, can be a bit difficult. EDIT: After publishing this post, I realized that I had forgotten about the incredibly helpful Map.update/4...

Ecto Stale Entry Error – Solving This Cryptic Elixir Error

The Ecto stale entry error (Ecto.StaleEntryError) is one of the more cryptic errors you'll see in Elixir. Elixir is pretty good about providing helpful error messages and information, but this one left me scratching my head. Until I figured out one simple cause of the Ecto stale entry error. Ecto Update If you are using Ecto's update/2 callback, you may have come across this error. To get to the...

Performing Bulk Updates with Ecto And Elixir

Updating one database row in Ecto is straightforward. But figuring out how to bulk update rows using Ecto without updating one record at a time? Now that is a pain. What if there were a way to bulk update rows of data in your database using only ONE update call? Well, there is, and in this post, I'll show you how you can do it using Ecto without having to write a single line of SQL. Ecto update/2...

How to Use IEx.pry in Elixir Tests

Elixir's IEx.pry is a great debugging tool. It allows you to stop time ("pry") in the middle of your application in order to inspect the conditions in which your app is currently running. However, if you've ever had to try and use IEx.pry while running your Elixir tests using mix test, you've probably encountered a problem. It won't actually work. You may have seen an error similar to this:...