Creating the Newsletter Subscription - Frustration with AI

In this post, I am not going to go into detail about my newsletter subscription. It is a simple idea - key in your email and it is supposed to go into the database. It should be easy for AI vibe coding right?
At this point, I am using Cursor to do my vibe coding. Vibe coding's great, don't get me wrong, but I thought it made sense to also detail the frustrating aspects of it so anyone who is interested in using it will know what they are getting into.
Initial Set Up
The initial set up of the code to display the newsletter form, as well as the code to create the database was done up by Firebase Studio. That was before my move to cursor. I had asked Cursor to help review the code and give me instructions on how to set it up with Firestore. Cursor did very well, and I managed to key in my first email address.
Feeling pleased with myself, I proceeded with asking it to develop additional features like ensuring no duplicates, rate limiting. These were features Cursor had suggested after completing its original task. On hindsight, I should have tested it further.
Code Broke After Implementing New Features
After implementing the new features, I encountered error after trying to add new email addresses. It was frustrating because Cursor kept checking on the Firebase Hosting set up or the Firestore rules. No matter how much I prompted, it was doing the same thing.
At one point, it created new pages just to test the connections. Every page had a different intent to try and troubleshoot the pages. But no matter how many times I updated it on the test results, it kept on trying to troubleshoot the Firestore rules.
I moved to ChatGPT because Cursor was asking me to check if the Firestore database was locked and I had no idea how to do it. The page Cursor asked me to visit did not show the status. ChatGPT on the other hand, told me to check the uploaded rules and taught me how to interpret whether it was locked.
Code Understanding Still an Essential Skill
At that moment, I realised ChatGPT used the example of write access, while the firestore rules showed create access. I turned back to Cursor, and suggested that it might be due to the write access. Cursor agreed and modified it, but the error persisted. I would have expected Cursor to have known the difference between create and write.
Troubleshooting is Still an Essential Skill
Next, I suggested to Cursor that the Firestore database might be alright and it might be the codebase instead. It created a new page to test writing to the Firestore database, which now also worked because of the "write" vs "create" rules. But the main newsletter page continued to fail. Cursor then finally agreed it might be the codebase.
After some time, it realised that as part of the no duplication code, it needed to check whether the email existed in the database. Hence, it required read access. After implementing it, everything worked
Conclusion
We cannot expect vibe coding platforms to do the job completely for us. It is still an important skill to be able to read and understand some fundamentals. For me, understanding databases in general helped me to understand write, read accesses. Despite not having the skills for this particular database tool/provider, it was helpful for me to help point out possible errors. Similarly, it is important to have coded web applications before and understand how things might break. With previous experience, I was able to prompt Cursor into discovering the error eventually.
Subscribe to my newsletter
Read articles from Kenneth Tang directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
