I went to check courses on 100xdevs @kirat_tw but i got confused on which cohort to start at? The oldest or the latest one, after reading the syllabus it seems like i can join either of em, as goal, is to learn in the right way while i build. Help me out pls.
@sagar_codes Very nice story, it revises the SOLID principles and how important it is for developers to know what exactly these principles are, and why to use them almost all the time. Keep posting more!
@diligentium@rabbit_hmi That's what I thought. Many of us also prefer typing and seeing options to compare. I belive rabbit r1 can do the comparison and pick the best option for us, but what if we sometikes, want to compare things ourselves? It's USP rn is being different, creative and cheap.
@codewithsharma False. Cuz arr1 and arr2 actually have address where the actual arrays are stored, and No two addresses are same. Even if you do arr1 === arr2, it will be false.
A short debugging story to start off the new year.
Developer (D): Hey, can you join a call? I need some help in debugging a webhook API connectivity issue. The customer team is also on the call.
Team lead (You): Okay sure, add me to the call.
You: So, what are you trying to do and what's the problem?
D: Our backend has a webhook API that a third party will invoke over the internet. The customer team from that third party is on the call. They are getting a 500 error when making this API call.
You: Okay, what's the error? And before that, can you tell me the HTTP request flow?
D: Yeah, so the error is related to TLS and I am not sure how to debug this. The request flow is as follows:
Third-party --> Firewall --> Nginx --> Our backend
You: Okay, have you tried exposing the API on staging on http instead of https?
D: Yes, this is on a staging environment, and the http API works. When I switch to https, we get an error in the third party.
You: Okay, where does the TLS termination happen in the above request flow?
D: (long pause) I think it happens at Nginx.
You: Sure?
D: (thinking...) Yes, I have configured the certs in Nginx.
You: So the Firewall is Layer 4 and Nginx acts as Layer 7 and terminates TLS?
D: Yes
You: Can you try making a call to webhook API from your local machine via curl or Postman?
D: (tries to demo this, but the call times out)
You: Is there any IP whitelisting at the Firewall level to make sure we allow the webhook API call only from that third party and no one else?
D: Yes.
You: Can you try removing the whitelisting for testing purposes right now and try the request from the local machine again?
D: (demos this use case, curl works okay, returns 4xx due to missing auth headers)
You: Can you open the url (used only as an example here) https://t.co/CzCpok00PR on your browser?
D: (demos this use case, on Chrome, it shows "Not secure" even though the protocol is https)
You: Interesting, show me more details about the certificate on Chrome.
D: (shows the details) Where are we going with this?
You: See, the certificate you're using is not valid for the subdomain. It's only valid for the main https://t.co/YD6SOHMNeK domain. So, you're getting an error on the third party. The third-party strictly checks the certificate, so you're getting a TLS error.
(you continue): I wonder why it works via curl as it should also perform a strict check as we didn't pass `-k` or `--insecure` flag.
D: Oh, I have set up a default config in curl to always use the `--insecure` flag to make testing easier.
You: (smiling) Ah, that explains why! So, the TLS error issue is due to the bad certificate. You'll need to use the correct cert for a subdomain or a wildcard cert that works on all subdomains and update your Nginx config accordingly.
D: (hours later) Thanks, this issue was fixed. How do I learn to debug like this?
You: Here are the lessons
- Learn the end-to-end request flow and the whole stack (from Layer 4 to Layer 7, at least)
- Understand how proxies operate, what's TLS, DNS and how certs work
- Get familiar with basic networking utilities - curl, nslookup, netstat, telnet, tcpdump, and more
- Try to form a mental model about how things work and a hypothesis about where the problem could be
- Only change one variable at a time when debugging
- Only change what's relevant to your hypothesis and revisit your hypothesis and mental model
- Practice and learn from past incidents and war stories from seniors
---
I write such stories on software engineering.
There's no specific frequency, as I don't make up these.
If you liked this one, you might love - https://t.co/Yyw99hddN4
Follow me - @chinmay185 for more such stuff, straight from the production oven!
The untold history of web development:
1990: HTML invented
1994: CSS invented to fix HTML
1995: JS invented to fix HTML/CSS
2006: jQuery invented to fix JS
2010: AngularJS invented to fix jQuery
2013: React invented to fix AngularJS
2014: Vue invented to fix React & Angular
2016: Angular 2 invented to fix AngularJS & React
2019: Svelte 3 invented to fix React, Angular, Vue
2019: React hooks invented to fix React
2020: Vue 3 invented to fix React hooks
2020: Solid invented to fix React, Angular, Svelte, Vue
2020: HTMX 1.0 invented to fix React, Angular, Svelte, Vue, Solid
2021: React suspense invented to fix React, again
2023: Svelte Runes invented to fix Svelte
2024: jQuery still used on 75% of websites