Practical Microservices:

The code for this book was written several years ago. I’m struggling to get things working with current tools. Even running the code included with the book doesn’t work anymore. For instance, taking the first-pass code, running the database using the docker-compose.yaml file, I get timeouts trying to connect to the database. So, the question is, is there a route for getting support to be able to use the content of the book using current tools, or is this book now essentially pointless because the examples are no longer valid?

Hi there, author here.

When I wrote the book, Node’s current LTS was v12. Shortly after publication, Node went to LTS 14, and that broke the node pg package’s current version.

So, that leaves you with a couple of options. If you run Node v12, which is what the package.json specifies, everything should run fine with the code as-is. I would find this solution rather unsatisfying, but if it works for your purposes, go for it!

Otherwise, if you’re on 13.x+, then you’ll need to update to the latest version of the pg package. That should get it going.

1 Like

I get that these things change. Particularly in the world of JS, things tend to change very quickly. This is the sort of information I’d expect to find in the errata/whatever information. Since things change quickly, I certainly don’t expect completely up to date information all the time, but occasional updates, including to the sample code, would be useful.

Managing that can be tricky, I suppose. But perhaps having the code occasionally updated, while having a folder that includes the original code that matches the text.

I came across another problem, which I wasn’t sure how to get around. One of the packages, colors, I think, no longer accepted the given ‘requires’. It said that it now expected an import. Which, it seems, required switching everything to ES6. I’ve now done that and gotten everything working. It was just a frustrating intro to the book, having to spend hours trying to get the base code working so that I’ve got the foundation in place for the remainder of the book.

Anyway, I appreciate your swift responses. Hopefully I won’t encounter too many more obstacles that distract me from the core information of the book.

Oh my goodness, that sounds terrible! I’m so sorry that was your experience, and thank you for bringing it up because that means probably a lot of people are having that same first experience.

Your point is well-taken, and I’m going to do some things about it today. I do a (mostly) daily Twitch stream to . Recently, I’ve been porting the book’s code from the JS library I rolled in the book to the Ruby-based Eventide Project. Anyway, today’s is going to be what one needs to do to get the code working properly these three years later. I’ll then cut that into a YouTube video walking folks through it. Then I can post that here in DevTalk, and hopefully folks will see it.

That’s particularly nasty about the colors package. That happened with an unrelated project I’ve been working on, and, well, I wouldn’t rank it as a top-5 life experience.

I’m also talking with PragProg about what options we have. They’ve been quite responsive, so I’m sure we’ll be able to get something better in place soon.

Again, thank you for bringing it up so that I could know there was something that needed attention.

It’d be useful to know what the docker compose files are doing, too. Since I couldn’t get the first one to work, I’m having to figure out what to do with the container I did get working to be able to continue through the book.