management stories Team building

Project empathy, day one

Today was my first-day writing code for what I call “the empathy project” to build empathy for what engineers go through.

Here is how my first day went.

I started with an existing template to give a good starting point. After following the instructions, I downloaded the template and ran into my first error.

Something about a secrets.json file not found. Why is this template looking for that file? No idea, so I go on google to find my answer.

After multiple articles, I found a stack overflow answer that looked promising.

I tried their solution and ended up getting through my first bump!

Since I changed the project, I figure I needed to add it to source control, you know, so I won’t lose all the hard work that cost me a ton of reading to get to the one-line change I made.

So I create a repository in GitHub and then attempt to upload my existing project to it.

The second issue of the day, I forgot my git commands 😭, so I got on Google again to refresh my mind.

I managed to upload to GitHub and create a new branch — success.

Ok, let’s try to build and rerun the project. Another error shows up. This time it is something related to the connection string to my database.

Wait, database? I didn’t set one up yet. So I get on google again to figure out what people like to use nowadays for starter projects.

The template I used uses entity framework, a Microsoft ORM, so I’ll need a relational database.

My search takes me to Heroku. Since they have a free tier for their Postgres DB, I create an account and copy the connection string.

This part I remember, add the connection string to the config file, and we’re good to go, right?

Not so fast. After adding the connection string, I type the run command and run into one more error 😨something about the connection not being secure.

This one took a lot of trial and error, google gave me the answer, but things didn’t seem to work.

The solution turned out to be the difference between typing “SSL Mode” vs. “sslmode.”

Ok, it looks like I can connect to now, I run the project once again, and this time the browser shows up for about one second… it just blinked in front of me, then disappeared with all my hopes.

This time, we appear to be missing our database tables.

I missed a step in the instructions and forgot about database migrations.

Ok, let’s run the existing migrations, and we’re good to go, or so I thought… I tried running the migrations, and more errors showed up.

More googling and lots of reading through the docs to uncover that the existing migrations were done for SQL Server and not compatible with Postgres.

I deleted the migrations, created new ones, and tried again. This time, the tables get made, and my hopes are back.

I type the run command again and cross my fingers, hoping that things will be ok this time.

Things are loading. My terminal is showing more messages than before. For a second, I can see into the matrix.

But then, big red messages pass by quickly, and everything stops again. I am deflated now. What else could it be?

The logs show a problem with an insert statement with a date-time field of type local, but the column only supports UTC.

At first, I start reading into the date-time type in Dotnet core, and sure enough, there is an attribute to set the type, but there is no default value, so my error isn’t making sense. Somewhere in the code, we’re setting date times to local.

After more searching, I found the code to insert data to the DB. It was passing clock.now. I looked into clock. I figured out it is part of the template and not the framework, so I quickly searched the documentation and changed the default type to UTC for clock.

Let’s try again! Things are running, and finally, the browser opens up to the login screen.

I was thrilled and tried to log in with the default credentials provided.

I got redirected to a JSON blob 😭.

I am about to cry now.

The logs are not showing anything meaningful this time, so I checked the network settings in the browser and saw a bunch of errors related to files not loading, yikes.

More reading and googling, this is getting old, anyway, I now have to build my front end by running another command.

This time, everything should work.

I run the run command, and everything seems to be working well for the first time.

The pages show up. I can log in and do quick updates.

I am now ready to commit and push to source control.

I am reviewing what I am sending, and oh the horror, config files with credentials to my DB!

This should be easy. I’ll have to move the connection string to the secrets.json file so that it is only available on my machine 😊

Well, that didn’t work. Moving the connection string caused me to lose connectivity to the DB.

I do more googling to figure out why I can’t read from the secrets file, but I am increasingly frustrated, so I decide to go with what is familiar to me, environment variables.

I set my connection string to an environment variable, updated the code to read from the environment variable instead of configuration files, and reran everything. Success! This time for real.

I feel good about pushing my code, I looked at the time, and it has been over five hours, to my surprise.

If the success criteria for the project is to build empathy for engineers, day one proved to be highly successful.

I’ll pick this up after the holidays, so stay tuned for day two.

Icons made by berkahicon from www.flaticon.com