Posts

Middle Stack Developer

"Hi I'm Klee." "What do I do? Well... I'm trying to coin to term Middle Stack Developer." was the way I introduced myself across my time at Web Directions Code this past week. I like the idea of calling myself a Middle Stack Developer because I don't like the term Full Stack Developer. I don't believe that one person is able to fill out all the roles of a software delivery team. No, not even with so many companies providing SASS solutions that effectively provide specialists as a service.  What's a Middle Stack Developer? A general purpose developer, a willing generalist, someone who is happy to work across the the scope of software deployment and delivery while acknowledging that there will be places where they need to differ to a specialist.That is to say I can work in the browser but need someone to help me make things accessible and beautiful. I'm comfortable with Cloudformation but you'll need someone else to make your AWS instance …

JWT - Explain it to me like I'm 5

Image
The following is a rough transcript of the talk I gave recently at the Newcastle JS meetup.  With the title JWT for 5 year olds.
This was one of the most fun talks I've put together and one that I hope everyone enjoyed.



Lets start with a story.

This is Millie. Millie has been baking cookies.


Millie has baked too many cookies and decides to take them to class. So she puts them in a box.
She takes the box to the teacher and says "Miss! Miss! Miss! I baked some cookies, can I hand them out to the class?"

The teacher looks at the cookies and says, "No! No you may not. If you want to hand out these cookies you need a note from you parent"


Millie runs out to the car and gets her father to write a note.


Millie takes the cookies and the note back to the teacher and asks "Miss! Miss! Miss! Here's my note, can I hand cookies out to the class?"

The teacher looks at the note and the cookies and says, "Yes! yes you can. This note says you can hand out coo…

AWS SAM/Api Gateway is swallowing my errors!?

AWS SAM is a great tool that has made my life so much easier when building Lambda functions that are accessible through API Gateway.

The one thing that has caught me out a couple of times is I don't get errors returned through API gateway when using the Node JS starter from $ sam init. 

As I'm testing I find a bug, as hard as I try I just cant manage to work out that "Just don't write bugs" coding strategy.  When I hit the bug I'm expecting to see the error as the response in Postman because of this block:

} catch (err) { console.log(err); return err; }
What I get though is a 504 response with no body.

While this is part of the starter if you want to return the value through API gateway when an unexpected error occurs you need to have the error wrapped in the same format as the body in the starter.  Like this:

} catch (err) { console.log(err); return { statusCode: 500, body: JSON.stringify({ err: err }) }; }
With…

2018 review & 2019 goals

At the very end of 2017 I put together a quick blog post listed down some goals for things that I would like to achieve in 2018.  Now that we've ticked into 2019 I want to review what I put down and list out some new goals for 2019.
2018 in review Looking at the goals I set I did pretty well over all. Reviewing:  Speak More I managed, I gave several talks around Newcastle, got selected to speak at DDD Sydney for the 2nd year running and got selected to speak at NDC Sydney.  Submit More I managed to Submit to more than 5 conferences and was selected for 2 different talks.  Keep Coding & Keep Working I did both of these things. I'm still happily employed at nib and am still in a role that has me focused on code and systems development. I did fall down when it comes to Blog More. I only published 6 blogs last year, where ideally I would have liked to have published 12.

Overall 2018 went well I achieved a lot of the goals I set out to. Towards the end of the year after conference…

GraphQL Express: Queries on child items.

Full disclosure this blog is me learning in public. Maybe this is obvious to you, maybe there is a better way to do this, if so let me know. In the end it caught me out so I thought I'd write down what my solution ended up being.

The problem: In the GraphQL documentation the servers are always shown returning simple hello world style results. I wanted to be able to find all the items associated with a user ID and then all items that match certain criteria within that set. The project that I have been using to learn GraphQL is an implementation of the Tech Radar idea that was popularised by ThoughtWorks. In this the client can select a radar and potentially a subset of the items on the radar, say they only want to display a single section.

In the GraphQL Express examples it shows how to grab top level items, filtering these is easy. You can grab all the data from your data source and pass it through a filter function and return it. Simple. It looks something like this:

1 2 3 4 5 6 7…

GraphQL query for list of items

I'm starting to look into GraphQL. It's got a lot of hype at the moment and there is more and more pressure to start playing with it in production applications.

It's got a bunch of advantages and a quick play shows me that it's not just hype. There is plenty of information available on why you would want to use it, if you're looking for that kind of thing I'd suggest starting with https://graphql.org/.

One limitation that I have come across when I was looking to implement a small application with some colleagues was that there doesn't seem to be a way to query for a known list of items without making the server support it. I'll use GitHub's GraphQL API as an example.

Lets say I have a curated list of repositories that I would like to query for as far as I can see there is no way to enumerate over that list within the GraphQL syntax. It is simple enough to get a list of repositories for a given user but I haven't been able to work out (yet?) how …

Logout from Auth0 SPA

Image
I have been working through some Auth0 tutorials lately to get an understanding of how to implement it in production.

One thing that is missing in the Auth0 SPA basic tutorial is how to log the user out. I got a bit panicked when I first used it and didn't see the login screen after logging out.  It's not enough to simply clear the tokens from the local cache you need to call logout on the Auth0 Client.

This is all pretty simple once you know it needs to happen.

1. Update the code in the log out method to call logout with the desired return value:

1: logout() { 2: // Clear Access Token and ID Token from local storage 3: localStorage.removeItem("access_token"); 4: localStorage.removeItem("id_token"); 5: localStorage.removeItem("expires_at"); 6: // You don't need navigate to the home route anymore 7: // Auth0 will redirect you 8: // history.replace("/home"); 9: // Call logout with white listed ret…