How to Fix: Could not establish connection. Receiving end does not exist

If you are developing a Chrome extension with message passing, then you might have received the following error: Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.. There was some type of behavior change that happened post Chrome 72 that affected the way channels are opened. Essentially, if you try to call runetime.connect() before you have a a channel open, then you will get this error (Stackoverflow).

Kafka Nodejs Example with Producers and Consumers

Let’s take a look at a Kafka Nodejs example with Producers and Consumers. We will be creating a kafka producer and consumer in Nodejs. If you haven’t already, check out my previous tutorial on how to setup Kafka in docker. I already created a topic called cat that I will be using. Kafka Producer We are going to use the npm module called kafka-node to interface with our kafka and zookeeper.

Setup Kafka Zookeeper in Docker

Setting up Apache Kafka and Zookeeper in docker is easy thanks to popular DockerFiles like wurstmeister/kafka-docker. Let’s go through a quick setup of Kafka and Zookeeper in docker on a single node system. Prerequisites Linux System Git Docker Docker-compose Kafka and Zookeeper Start by cloning the repo: git clone https://github.com/wurstmeister/kafka-docker Then change to the kafka-docker directory: cd kafka-docker Now let’s edit the docker-compose.yml file. Change the Kafka Advertised Hostname to localhost:

Flying a Drone With Javascript

Flying a drone with javascript probably sounds crazy and hard. Do I use a framework? Will the 10 GB of node_modules weigh it down? NOPE! It’s all pretty simple to do. The other day I came across a neat drone called the DJI Tello. It is a relatively inexpensive quadcopter that offers a simple SDK which can be accessed over WiFI. Using the NodeJS dgram library, I can send commands via UDP to the drone to perform actions such as takeoff, left 20, and land.

Scrape Google Search Using Puppeteer

For my side project, I needed to scrape Google search using a headless browser. I ended up using the Nodejs library called puppeteer. It’s a headless browser that uses chromium. Install puppeteer npm install puppeteer Scrape Google Search using Puppeteer First, let’s go to the google homepage, type something in, and click the search button. try { (async () => { const browser = await puppeteer.launch(); const page = await browser.

Install Hyperledger Fabric on Kubernetes

I recently had the “amazing 🙄” opportunity to spend two weeks figuring out how to install hyperledger fabric on Kubernetes. There aren’t many guides on the internet besides this one. Unfortunately, I found it to be very vague and missing some keys steps. For this tutorial, let’s go step-by-step on how to install hyperledger on kubernetes. We are going to use some information from the guide linked above, along with some stuff my team and I were able to figure out along the way.

Why I Switched From WordPress to Hugo

WordPress isn’t awful. In fact, I recommend WordPress to everyone who wants to start a blog. Despite this, I switched from WordPress to Hugo a couple of weeks ago. The real reason came down to cost and simplicity. Cost Running a WordPress blog meant that I needed a good shared hosting environment with a MySQL server and PHP execution. I first tried Hostgator, and it was sufficient enough while my blog had less than a hundred of visitors per month.

Read System Environment Variables in Angular

A few weeks back I was working on a project where I needed to read system environment in Angular 7 from a Docker container before it builds. After days of searching, I came across a solution from multiple sources on the internet. Keep one thing in mind, you will only be able to inject environment variables before your Angular app builds. Unlike Nodejs, you will not get real time access because you are running in an browser environment.

How to Setup Search on Hugo

Setting up search on your static site built using Hugo or Jekyll is not as difficult as it sounds. If your static site is hosted on GitHub pages (which mine currently is), then you will not be able to use php or any server side scripting. Therefore, we must rely on a pure javascript solution. Using Lunr.js Lunr is a popular library used to parse through data and return the most accurate match based on a search query.

JWT Tokens in Express and NodeJS

The JSON Web Token (JWT) is the easiest standard for protecting APIs and passing in claims data. A JSON Web token allows the server to verify the authenticity of the user and provide them access to protected API routes and data.  A simple JWT flow goes as follows: The user sends login credentials to the server The server verifies user against the database then returns a JWT token if valid The user sends that token in the header with every request to API.