We have a backend API app in Google Cloud using all the Kubernetes goodness. For some reason, we don’t use a Google Cloud backed MongoDB service. Instead, we spin our own MongoDB replicaSet using one of the stable helm charts mongodb-replicaset.
- NestJS framework for the backend service – latest as of writing
- Mongoose library for MongoDB connectivity – latest as of writing
- MongoDB 3.6 replicaSet hosted in GCP with mongodb-replicaset helm chart
Here is the
DATABASE_URL for reference:
The helm chart for the MongoDB replicaSet just do the magic where it exposes one service name and under the hood, there are 3 replicas with 1 primary and 2 secondaries. The setup is pretty straightforward.
The problem occurs when we do a simple read like
findById using the Mongoose models. No errors are being thrown and the read process didn’t proceed to the next line of code as if it is stuck indefinitely.
We didn’t really find any solution for now so the temporary fix is to remove the read preference.
I’m hoping to find some alternative helm chart or better yet, fix the real issue and still enjoy the awesome helm charts that give us stable deployments.
What’s up? Its been a very long time since I’ve posted something in my blog. I’m been very busy with my current job at a startup and it has gotten a good kick start. I’m also busy with trading equities … Continue reading
Out NestJS tests are intermittently failing with “not enough memory” error being thrown. There is nothing really special about the tests except for the fact that it is growing as the project grows. It turns out a simple CLI parameter … Continue reading
Posted in NodeJS
I just wanted to test that a certain async call should throw an error and I tried it on Jest. I’m already familiar with RSpec which has similar syntax. Below is what I did. The exec method is an async … Continue reading
I was playing around with MongoDB ReplicaSet yesterday in a Docker environment. The purpose is to test the integration with a backend service that connects to MongoDB. It was a very frustrating process especially when done in a local environment … Continue reading
TLDR: Do not put any double quotes or single quotes into the environment parameter in the docker-compose.yml file. Do we really need the long version of the story? Instead of this: Use this instead: Now this is odd as I … Continue reading
As of early June 2019 using the latest version of Expo, I’m not able to use Redux as I’m getting this error memo is not a function when trying to use connect. Spoiler, it is because Expo is using a … Continue reading
I can’t believe that I can’t easily encode and decode Base64 string in React Native without pulling my hair. I’m using Expo to manage my development workflow and it even adds more confusion. Thankfully, a little trick saves me from … Continue reading
When I tried to login to First Metro Securities today, it says that my password already expired and won’t let me log in. I think I went to the classic version and tried to login too but when I changed … Continue reading
My setup is in a Windows 10 machine with VirtualBox installed with a Host Only Network added by VirtualBox. Every time I run expo start it always picks up the VirtualBox network adapter instead of my machine’s Ethernet adapter. Without … Continue reading