Lessons Learned From Troubleshooting a Shopping Cart Issue

Rate this content
Bookmark

Production errors can be tricky, especially when you can’t reproduce them easily or they don't happen very often. In this talk, we’ll go through a case study of a quantity mismatch Shopping Cart issue and what troubleshooting steps we took to solve it. Then drawing from that issue some lessons that we can all learn from as frontend developers.

This talk has been presented at React Day Berlin 2022, check out the latest edition of this React Conference.

FAQ

The main issue discussed was a bug in a restaurant marketplace app where customers reported receiving incorrect quantities of items in their orders.

Hussein is a staff developer at Shopify with around 10 years of full-stack development experience and 7 years of experience working with React.

The bug involved customers receiving different quantities of items than what they ordered, often more than they requested.

The bug occurred less than once a month initially but became more frequent as the customer base grew.

Initial steps included checking backend data, server logs, and emails sent to suppliers. The data always appeared correct, which led to the dismissive attitude towards customer complaints.

Hussein used Fullstory, a user session recording and analytics tool, to identify the bug in the frontend.

The root cause was poor Wi-Fi in restaurant kitchens causing some requests to the server to be lost when customers rapidly clicked the plus button to add items to their cart.

They resolved the bug by using the quantities displayed to the customer at checkout as the source of truth, rather than the server data.

Lessons included the importance of not always assuming the server is the source of truth, approaching bugs with the mindset that it's likely your fault, the usefulness of screen recordings, and testing apps under non-ideal conditions.

Testing under non-ideal conditions is important because real-world scenarios often involve poor network conditions, and ensuring the app works under such conditions can prevent bugs and improve user experience.

Hussien Khayoon
Hussien Khayoon
9 min
02 Dec, 2022

Comments

Sign in or register to post your comment.

Video Summary and Transcription

This Talk discusses lessons learned from troubleshooting a shopping cart issue in a restaurant marketplace app. The bug was difficult to reproduce but occurred more frequently as the app grew. The investigation involved checking frontend logs and using tools like Sentry and Fullstory. The solution involved using the customer's view at checkout as the source of truth and emphasizing the importance of testing and financial responsibility.

1. Lessons from Troubleshooting Shopping Cart Issue

Short description:

I'm going to talk about lessons learned from troubleshooting a shopping cart issue. Today we're talking about React and working with an ecosystem. I'll share a bug I encountered in a restaurant marketplace app. It had a standard eCommerce flow, but a strange problem occurred.

I'm going to talk about today about lessons learned from troubleshooting a shopping cart issue. So, most of us have used shopping carts. My name's Hussein. I'm a staff dev at Shopify and doing full stack for about 10 years now. React for seven. I've made every possible mistake with React. There's my Twitter there, if you want to give me a follow. Chelsea fan, unfortunately.

Why this talk? So, today we're talking a lot about React. A lot of us use React. We code in React. But the reality is, you always work with an ecosystem. Every time. So, whether it's the browser you're using React on, the web APIs, like you saw a lot of event listeners. You deal with customers, if you take a step back. All of us deal with customers in our code. And we're always having a business domain. Specifically me, I'm in eCommerce now. So, we all deal with those. So, you deal in an ecosystem, it adds complexity to your app, which in turn adds bugs to your app. And today I'm talking about one of those bugs that I had.

Just a brief background about this bug. It wasn't at Shopify, it was at a startup I worked at before in 2019. It was a restaurant marketplace app, built in React and Redux, hundreds of users, millions in GMV, not that big, compared to Shopify, of course. We had about 50 employees, like about 10 to 15 were in tech developers. So, there's a happy path to the app, which is pretty standard in eCommerce. You log in, add items to your cart, provide shipping info, pay, get that money, and then receive your items. Pretty standard, right? Like this is what most eCommerce sites do. So that's what we had. But then we had a very strange problem up here.

2. Troubleshooting Shopping Cart Bug

Short description:

One month or less, a customer would report a bug where they received fewer items than ordered. We checked the order on the back end, server logs, and emails to the supplier. Our data in the database matched everything, so the customer made a mistake. It's important to consider assumptions when troubleshooting bugs.

One month or less, like every once a month or less, a customer would report a specific bug, and they said they received less items than what they actually ordered. So what does that mean? So, the app is kind of like very different now. So I had to do a little bit of screenshot work. So you can see here, five cases of pineapple for example, is what they ordered. So a customer, for example, would say they actually got six or seven cases, not five. Very strange, very bad. So what do we do? In the startup life, we did the same thing any developer would do. Check the order on the back end. Make sure the numbers were correct. Checked our server logs, see if there were any errors, and that the numbers matched up. Check the e-mails that we sent to the supplier, were they a correct number. And what we saw is it turns out our numbers in the database match everything. So we said, customer, you're wrong. Our data is right, too bad. You know what I mean? So you made a mistake, essentially. And that's why it's important to, kind of, talk about our assumptions when we have bugs. So this gives you some context into what we were thinking at the time.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Remix Flat Routes – An Evolution in Routing
Remix Conf Europe 2022Remix Conf Europe 2022
16 min
Remix Flat Routes – An Evolution in Routing
Top Content
Remix Flat Routes is a new convention that aims to make it easier to see and organize the routes in your app. It allows for the co-location of support files with routes, decreases refactor and redesign friction, and helps apps migrate to Remix. Flat Folders convention supports co-location and allows importing assets as relative imports. To migrate existing apps to Flat Routes, use the Remix Flat Routes package's migration tool.
How to Make a Web Game All by Yourself
JS GameDev Summit 2023JS GameDev Summit 2023
27 min
How to Make a Web Game All by Yourself
This talk guides you on how to make a web game by yourself, emphasizing the importance of focusing on tasks that interest you and outsourcing the rest. It suggests choosing a game engine that allows distribution on the web and aligns with your understanding and enjoyment. The talk also highlights the significance of finding fun in the creative process, managing scope, cutting features that don't align with the game's direction, and iterating to the finish line. It concludes by discussing the options for publishing the game on the web and leveraging unique web features.
Atomic Deployment for JS Hipsters
DevOps.js Conf 2024DevOps.js Conf 2024
25 min
Atomic Deployment for JS Hipsters
This Talk discusses atomic deployment for JavaScript and TypeScript, focusing on automated deployment processes, Git hooks, and using hard links to copy changes. The speaker demonstrates setting up a bare repository, configuring deployment variables, and using the post-receive hook to push changes to production. They also cover environment setup, branch configuration, and the build process. The Talk concludes with tips on real use cases, webhooks, and wrapping the deployment process.
Your GraphQL Groove
GraphQL Galaxy 2022GraphQL Galaxy 2022
31 min
Your GraphQL Groove
The Talk discusses the value proposition of GraphQL and its ability to solve common pain points in API development. It highlights the importance of making informed decisions when choosing GraphQL clients, servers, and schema builders. The Talk also emphasizes the need to focus on the best developer experience in the present rather than seeking a perfect long-term solution. Additionally, it mentions the future of the Urkel GraphQL client and the reasons for dropping ReScript support. Overall, the Talk provides insights into the current state and future trends of GraphQL development.
Full-stack & typesafe React (+Native) apps with tRPC.io
React Advanced Conference 2021React Advanced Conference 2021
6 min
Full-stack & typesafe React (+Native) apps with tRPC.io
Top Content
Alex introduces tRPC, a toolkit for making end-to-end type-safe APIs easily, with auto-completion of API endpoints and inferred data from backend to frontend. tRPC works the same way in React Native and can be adopted incrementally. The example showcases backend communication with a database using queries and validators, with types inferred to the frontend and data retrieval done using Prisma ORM.
Using UDP in the Browser for faster Client/Server Connections
JS GameDev Summit 2023JS GameDev Summit 2023
21 min
Using UDP in the Browser for faster Client/Server Connections
Top Content
This talk introduces geckos.io, a real-time client-server communication library using UDP and WebRTC. The speaker discusses the benefits of UDP for real-time multiplayer games and explains how geckos.io enables UDP connections between browsers and Node.js servers. The deployment process for geckos.io involves opening UDP ports and handling signaling through an HTTP request. The speaker demonstrates how geckos.io works with Docker and showcases the ability to host multiple servers on the same machine. Overall, this talk provides an overview of geckos.io and its applications in real-time communication.

Workshops on related topic

Integrating LangChain with JavaScript for Web Developers
React Summit 2024React Summit 2024
92 min
Integrating LangChain with JavaScript for Web Developers
Featured Workshop
Vivek Nayyar
Vivek Nayyar
Dive into the world of AI with our interactive workshop designed specifically for web developers. "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" offers a unique opportunity to bridge the gap between AI and web development. Despite the prominence of Python in AI development, the vast potential of JavaScript remains largely untapped. This workshop aims to change that.Throughout this hands-on session, participants will learn how to leverage LangChain—a tool designed to make large language models more accessible and useful—to build dynamic AI agents directly within JavaScript environments. This approach opens up new possibilities for enhancing web applications with intelligent features, from automated customer support to content generation and beyond.We'll start with the basics of LangChain and AI models, ensuring a solid foundation even for those new to AI. From there, we'll dive into practical exercises that demonstrate how to integrate these technologies into real-world JavaScript projects. Participants will work through examples, facing and overcoming the challenges of making AI work seamlessly on the web.This workshop is more than just a learning experience; it's a chance to be at the forefront of an emerging field. By the end, attendees will not only have gained valuable skills but also created AI-enhanced features they can take back to their projects or workplaces.Whether you're a seasoned web developer curious about AI or looking to expand your skillset into new and exciting areas, "Hands-On AI: Integrating LangChain with JavaScript for Web Developers" is your gateway to the future of web development. Join us to unlock the potential of AI in your web projects, making them smarter, more interactive, and more engaging for users.
Managers Are From Mars, Devs Are From Venus
TechLead Conference 2024TechLead Conference 2024
111 min
Managers Are From Mars, Devs Are From Venus
Workshop
Mo Khazali
Mo Khazali
A Developer’s Guide to Communicating, Convincing, and Collaborating Effectively With Stakeholders
It’s a tale as old as time - collaboration between developers and business stakeholders has long been a challenge, with a lack of clear communication often leaving both sides frustrated. The best developers can deeply understand their business counterparts’ needs, effectively communicate technical strategy without losing the non-technical crowd, and convince the business to make the right decisions. Working at a consultancy, I’ve both failed and succeeded in architecting and “selling” technical visions, learning many lessons along the way.Whether you work at a product company, are a consultant/freelancer, or want to venture beyond just being a developer, the ability to convince and clearly communicate with stakeholders can set you apart in the tech industry. This becomes even more important with the rise of GenAI and the increasingly competitive developer market, as problem-solving and effective communication are key to positioning yourself.In this workshop, I’ll share real-world examples, both good and bad, and guide you through putting the theory into practice through dojos.
How to create editor experiences your team will love
React Advanced Conference 2021React Advanced Conference 2021
168 min
How to create editor experiences your team will love
Workshop
Lauren Etheridge
Knut Melvær
2 authors
Content is a crucial part of what you build on the web. Modern web technologies brings a lot to the developer experience in terms of building content-driven sites, but how can we improve things for editors and content creators? In this workshop you’ll learn how use Sanity.io to approach structured content modeling, and how to build, iterate, and configure your own CMS to unify data models with efficient and delightful editor experiences. It’s intended for web developers who want to deliver better content experiences for their content teams and clients.