This Ridiculous Bug Cost Me Thousands of Dollars!!

  Рет қаралды 11,404

James Q Quick

James Q Quick

Күн бұрын

I couldn't believe these bugs ruined my newsletter!
*Newsletter*
Newsletter 🗞 - www.jamesqquick.com/newsletter
*DISCORD*
Join the Learn Build Teach Discord Server 💬 - / discord
Follow me on Twitter 🐦 - / jamesqquick
Check out the Podcast - compressed.fm/
Courses - jamesqquick.com/courses
*QUESTIONS ABOUT MY SETUP*
Check out my Uses page for my VS Code setup, what recording equipment I use, etc. www.jamesqquick.com/uses
*TIMESTAMPS*
00:00 - Intro
01:00 - Broken Astro Route
02:00 - String Interpolation Error
03:00 - What Could I Have Done?
06:00 - Incorrect HTTP Status

Пікірлер: 114
@ajzack983
@ajzack983 4 ай бұрын
after carful considerations I've decided that the best prevention for this bug is a good vs code color theme
@JamesQQuick
@JamesQQuick 4 ай бұрын
lol i'll keep that in mind
@uscjake868
@uscjake868 4 ай бұрын
Dang dude thats brutal. Proof that the smallest of things can have such an impact.
@PieterWigboldus
@PieterWigboldus 4 ай бұрын
I think it can help if you start defining first the input and output, of the system and methods. The system can be defined in OpenAPI, methods with tests (TDD)
@thegrumpydeveloper
@thegrumpydeveloper 4 ай бұрын
Lots of code solutions here but also monitoring subscriber counts and their source could help if something drops off. Observability and logging could have helped identify this issue earlier.
@JamesQQuick
@JamesQQuick 4 ай бұрын
Yeah paying more attention is something I'll do better this year!
@elmalleable
@elmalleable 4 ай бұрын
logging is important, since they dont return http status codes for errors , you'd have to check the the response is not successful (opposite of proving the subscription was successful) and log failures, or equally another request to validate that the subscriber exists and the log that response for monitoring, if you are not monitoring issues and errors, then you can't see sometimes play dumb with the code too and see what it does
@eqprog
@eqprog 4 ай бұрын
Yep, came here to say this. Logging and also some sort of reporting dashboard and/or alert system would go a long way.
@lukecartwright613
@lukecartwright613 4 ай бұрын
Thank you for sharing this for others to learn. With Astro, does it generate Client or server code? Can you add logging and monitoring too?
@JamesQQuick
@JamesQQuick 4 ай бұрын
You can do both client and server code with Astro. and yes definitely need to add some monitoring and logging
@naterpotatoers
@naterpotatoers 4 ай бұрын
You’re brave for putting this out there, respect. This makes me more zealous about TDD
@JamesQQuick
@JamesQQuick 4 ай бұрын
Yeah I definitely need to look into testing
@WebDevCody
@WebDevCody 4 ай бұрын
Does podia have rest api docs? It feels like their api is a backend for a frontend but you might be calling it think it’s an actually well crafted public api. The only reason I’d think they return JavaScript on an error is because they run it on their frontend to show an error message? Anyway sorry to hear about that bug. Sucks no one reached out sooner
@JamesQQuick
@JamesQQuick 4 ай бұрын
Nope! That's what sucks. They don't have an API at all. I just tried to reverse engineer their form submission. Ughhh lol
@jelilabudu
@jelilabudu 4 ай бұрын
3:10 Yeah, linter couldn't catch the error because it sees the last closing bracket as a mere string character.
@jordancalhouncom
@jordancalhouncom 4 ай бұрын
I hope this video blows up and gets you a nice influx in your newsletter, you're content is great!
@JamesQQuick
@JamesQQuick 4 ай бұрын
Thanks! Looks like signups are failing again even with the redirect and I have NOOOO idea why. UGH!
@0xO2
@0xO2 4 ай бұрын
Finaly statement block is being executed always: only try or try+catch. So, why there's the error setup?
@webcoderph
@webcoderph 4 ай бұрын
thanks for sharing
@JamesQQuick
@JamesQQuick 4 ай бұрын
Thanks for watching!
@omomer3506
@omomer3506 4 ай бұрын
You shoulve tried switching it off and back in again, works wonders. Loool . Thanks for the teaching moment and will subscribe
@JamesQQuick
@JamesQQuick 4 ай бұрын
haha how did I not do think of that 🤣
@aribasiebel
@aribasiebel 3 ай бұрын
I worked for a Unicorn. Their Saas backend endpoints broke all possible restful api best practices you can think of. The validation error is a property of the response wth a response status of 200 instead of 404. As their API is not public the bad code is still there ... offshore coders
@ChristianKolbow
@ChristianKolbow 4 ай бұрын
damn. thanks for sharing
@developerpranav
@developerpranav 4 ай бұрын
I had subscribed this way, gonna subscribe again! :D Thanks for putting this out in public!
@JamesQQuick
@JamesQQuick 4 ай бұрын
THANK YOU!
@MrRuudvane
@MrRuudvane 4 ай бұрын
It still gives an error when signing up tp the newsletter today on 9th januari
@JamesQQuick
@JamesQQuick 4 ай бұрын
Yeah what the hell?!?! It's throwing an error even on the redirect too. What is GOING ON?!??!!
@jordan4220
@jordan4220 4 ай бұрын
I see so many situations where web developers just willy nilly expect a payload to be json. You have to check the content type in the header before doing this, especially if you don't control the API. This is why standards exist
@theplaintech
@theplaintech 4 ай бұрын
Admire the accountability and professionality... props.
@JamesQQuick
@JamesQQuick 4 ай бұрын
Always learning from mistakes :)
@theplaintech
@theplaintech 4 ай бұрын
@@JamesQQuick And passing along the experience to help the rest of us live our best [coding] life!
@ClaudioBernasconi
@ClaudioBernasconi 4 ай бұрын
It hurts to see the bug/issue being so costly and non-trivial to fix. I hope you'll find a long-term solution for custom subscriptions for your email provider.
@JamesQQuick
@JamesQQuick 4 ай бұрын
Yeah maybe I need to look even more seriously. It's just a lot of work to move
@codeSTACKr
@codeSTACKr 4 ай бұрын
oh no! 🤯
@eleah2665
@eleah2665 4 ай бұрын
Wow. Quite a story. Thanks.
@JamesQQuick
@JamesQQuick 4 ай бұрын
Thanks for watching!
@Cap10Chunks
@Cap10Chunks 4 ай бұрын
Thanks for sharing. It was nice to see a real costly mistake and how you debugged/fixed it. The fact that you don't have any testing around that is crazy. I do QA for a living. Hit me up. I'd be glad to help build some regression tests for you.
@JamesQQuick
@JamesQQuick 4 ай бұрын
So glad you enjoyed it! Definitely going to add some things to help with this. Thanks for the offer!
@xWe2s
@xWe2s 4 ай бұрын
as the saying goes: "ALWAYS VALIDATE THE INPUT", whether it's by end user or yourself in this case 😅🙌 but yeah, terrible play podia 😭👊
@coffeeintocode
@coffeeintocode 4 ай бұрын
Transparency for the win 👌 sorry for the opportunity loss though
@JamesQQuick
@JamesQQuick 4 ай бұрын
Glad you appreciated it!
@DamonMedekMusic
@DamonMedekMusic 4 ай бұрын
I've had to build backend Stripe and PayPal API endpoints but my computer burst into flames and I woke up 2 weeks later in a North Korean ditch.
@jfprizzy
@jfprizzy 4 ай бұрын
Great content. After watching your video, I think the most pragmatic way to avoid these bugs in future, is to just not code at all at this point. How daunting... But thanks for sharing.
@JamesQQuick
@JamesQQuick 4 ай бұрын
So glad you got something out of it!
@coder4liberty
@coder4liberty 4 ай бұрын
I would have tried to do some discovery on what Podia returns when it's 200. Then again accounting for the content of all possible error messages from a third party service might not be a road to go down
@JamesQQuick
@JamesQQuick 4 ай бұрын
Yeah the struggle is that they didn't used to return the gibberish. I tested it originally but at some point they must have changed things :(
@dupre7416
@dupre7416 4 ай бұрын
I'm going to link this video in my team' s Teams chat. There are a lot of good gotchas and troubleshooting on evidence.
@JamesQQuick
@JamesQQuick 4 ай бұрын
Hope it's helpful!
@cduhn
@cduhn 4 ай бұрын
Tip: One other habit that will save you from tricky future bugs is to treat all responses < 300 and >= 200 as a potential success. Some services will respond to a successful POST with 201 Created, for example.
@adampielach4942
@adampielach4942 4 ай бұрын
I think it's better to check what was returned from the response, because we can't be so sure about that. One of the quirks I've discovered in one of my company's projects was a silent bug with 201 success returning no data which was considered as a false result and ended up in a catch.
@hohohotreipatlajele2044
@hohohotreipatlajele2044 4 ай бұрын
the importance of testing :)
@JamesQQuick
@JamesQQuick 4 ай бұрын
I knowwww!!
@JohnWilliams-gy5yc
@JohnWilliams-gy5yc 4 ай бұрын
Podia Backend Policy : Ah, ah. Not so fast, Mate.
@fngkarp492
@fngkarp492 4 ай бұрын
Why do you even use regular fetch at first place?
@JamesQQuick
@JamesQQuick 4 ай бұрын
What do you use?
@adampielach4942
@adampielach4942 4 ай бұрын
@@JamesQQuick There's nothing wrong with fetch, but it just lacks some additional error handling and some bells and whistles that, for example, axios has.
@JamesQQuick
@JamesQQuick 4 ай бұрын
Yeah that's fair. I kinda just go with whatever at the time.@@adampielach4942
@guzcampos
@guzcampos 4 ай бұрын
So, 8 months of not getting newsletter subscribers, weren't you regularly checking your subscriber stats on Podia to notice something? I'm not familiar with that platform but I assume they provide them? (New subscribers, bounces, unsubscribes, etc) In any case, great video and content, specially for JS beginners.
@JamesQQuick
@JamesQQuick 4 ай бұрын
I didn't pay a ton of attention. I just assumed I wasn't doing a good job of sending people to the newsletter
@jasondunken
@jasondunken 4 ай бұрын
I've run into the 200 status but with an error issue before, truly unhelpful.
@JamesQQuick
@JamesQQuick 4 ай бұрын
THE FREAKING WORST! lol
@Arashi1138
@Arashi1138 4 ай бұрын
"without testing.... obviously" I felt that in real life =/
@JamesQQuick
@JamesQQuick 4 ай бұрын
I mean... 🤣
@ste-fa-no
@ste-fa-no 4 ай бұрын
Oooh, the old 200 with an error message or even empty 🤪🆘
@oksen1990
@oksen1990 4 ай бұрын
True, too many use the HTTP status codes in a wrong way, fx. returning 200 instead of 400 or whatever appropriate status fits when an error happens....
@JamesQQuick
@JamesQQuick 4 ай бұрын
Yeah it really screws things up!
@dupre7416
@dupre7416 4 ай бұрын
too many mustaches
@DigitalKelvin
@DigitalKelvin 4 ай бұрын
Error logging
@marcoio8742
@marcoio8742 4 ай бұрын
Wait, did you use Podia public api? if you expected a 200 from a public api then sorry but it's on you. You should have read the docs, provided they are correct. if you didn't use a public api then again it's on you 😢
@JamesQQuick
@JamesQQuick 4 ай бұрын
I reverse engineered it so no official API. And yes, that's risky lol
@eqprog
@eqprog 4 ай бұрын
IMO it should have been a 204 response…. It found the end point but there was nothing to return
@tpurves2006
@tpurves2006 4 ай бұрын
If you had a dashboard tracking metrics, you would/should have seen a decline, which would have caused you to look to see why your sub counts dropped.
@christian-schubert
@christian-schubert 4 ай бұрын
If it gives you any comfort, I didn't even get as far as spotting the extra bracket, you had me all confused with 'POST' vs. 'post' 🤪 Still, this seriously has me questioning whether I should even continue pursuing programming altogether... UNBELIEVABLE 🤦 I gotta say though, sending back that 200 status is on the same level as storing passwords in plain text to a point where one could argue that it borders on gross negligence.
@JamesQQuick
@JamesQQuick 4 ай бұрын
haha thanks for sharing. and yes the 200 status is TERRIBLE!
@GiorgioTedesco
@GiorgioTedesco 4 ай бұрын
at first view maybe curly bracket... one more than enough...
@JamesQQuick
@JamesQQuick 4 ай бұрын
Great catch!
@Siddharthpandey27
@Siddharthpandey27 4 ай бұрын
If you just tested your code or written simple unit test it would have been prevented
@iPankBMW
@iPankBMW 4 ай бұрын
Thats Copilot fault - it usually puts extra curly braces….
@JamesQQuick
@JamesQQuick 4 ай бұрын
Yeah it definitely happens sometimes!
@kirayamato6128
@kirayamato6128 4 ай бұрын
you don't test that api endpoint? lol? looks like you are not the one who code it.
@LE8271
@LE8271 4 ай бұрын
Tested with vs code. It marks the second curly with red.
@JamesQQuick
@JamesQQuick 4 ай бұрын
It's just part of a string though. How would it know that that's something wrong?
@LE8271
@LE8271 4 ай бұрын
@@JamesQQuick I suppose it marks as unclosed. But it seems pretty unconsistent I admit. Wanted to post you a link but now when I reopen the file it marks red at first render for a few seconds. Once render finishes it turns back to normal string color. :/
@gabriellevesque2185
@gabriellevesque2185 4 ай бұрын
Stop blaming them for not testing your own code! :P
@th3n3rdman
@th3n3rdman 4 ай бұрын
TS would catch this.... just saying...
@JamesQQuick
@JamesQQuick 4 ай бұрын
This is using TypeScript...how would it catch this?
@adampielach4942
@adampielach4942 4 ай бұрын
It would not. Why would TS or any other linter care for what is inside string?
@JamesQQuick
@JamesQQuick 4 ай бұрын
Yeah that's what I was thinking@@adampielach4942
@deatho0ne587
@deatho0ne587 4 ай бұрын
3:50 a reason not to use string interpolation. Yes, it is nice but have seen this same mistake, glady it was caught in a day though. Edit: since this has gotten so many replies I do mention testing. I also mention why I might choose one over the other.
@oksen1990
@oksen1990 4 ай бұрын
I agree. I stay away from string interpolation if I can help it, and in my experience, it also makes the code easier to read.
@johnm8358
@johnm8358 4 ай бұрын
Nonsense, testing is a must with any code... Interpolation makes code must easier to read
@deatho0ne587
@deatho0ne587 4 ай бұрын
I actually do a mix - if variable part + var - if the string + vars are one line then interpolation - else (+ var)'s Saying that though since it is url with params, most frameworks have something to work with them.
@deatho0ne587
@deatho0ne587 4 ай бұрын
I agree that testing needs to be done, but string interpolation on multiple lines is hard to read.
@johnm8358
@johnm8358 4 ай бұрын
@@deatho0ne587 it's easier than reading multiple lines separated by plus signs
@levyroth
@levyroth 4 ай бұрын
So the lesson here is to stop using silly third-party services and write your own code instead. As always.... Podia is not necessary imho.
@JamesQQuick
@JamesQQuick 4 ай бұрын
Well, that's asking a lot. Podia is an entire platform with TONS of features. That would take me wayyyyy too long to build myself and my code would definitely be error prone. That said, this is pretty shitty on their part. I'm definitely upset lol
@mateja176
@mateja176 4 ай бұрын
It’s turtles all the way down. At some point you will have to rely on someone else’s code.
@thomassynths
@thomassynths 4 ай бұрын
zzzzzzz way to much buildup and hype
@buddy.abc123
@buddy.abc123 4 ай бұрын
What even is Podia? In all honesty these 3rd party services are unnecessary but the js influencers keep pushing them so we'll keep hearing about them
@WebDevCody
@WebDevCody 4 ай бұрын
It’s a complete platform for hosting your courses, newsletter, refunds, discount codes, communication with students, etc. building all of this stuff yourself is a waste of time because now all your time is spent building a course platform but all you want to do is sell a course. The drive to implement everything yourself is a good sign of a junior engineer.
@JamesQQuick
@JamesQQuick 4 ай бұрын
lol I had someone else say this is the reason to build it all yourself, and I was like...no chance lol
@omomer3506
@omomer3506 4 ай бұрын
Js is an unnecessary abstraction, we should all just create our version, for every program .................
STOP Using JavaScript For These 5 Things!
8:05
James Q Quick
Рет қаралды 17 М.
What tech I used to code my new startup in 2024
16:19
Anthony Sistilli
Рет қаралды 25 М.
格斗裁判暴力执法!#fighting #shorts
00:15
武林之巅
Рет қаралды 95 МЛН
How many pencils can hold me up?
00:40
A4
Рет қаралды 19 МЛН
The END of DISTRO HOPPING? All Linux distros in one single system with VanillaOS
16:34
Why Does Scrum Make Programmers HATE Coding?
16:14
Thriving Technologist
Рет қаралды 488 М.
DjangoCon US 2023: Don't Buy the "A.I." Hype
26:09
Tim Allen
Рет қаралды 11 М.
Scammers PANIC After I Hack Their Live CCTV Cameras!
23:20
NanoBaiter
Рет қаралды 2,5 МЛН
ESSENTIAL JavaScript Extensions for VS Code in 2024
14:02
James Q Quick
Рет қаралды 28 М.
Unlimited AI Agents running locally with Ollama & AnythingLLM
15:21
This reminded myself of why I dislike Next.js
20:10
Web Dev Cody
Рет қаралды 51 М.
10 JavaScript Interview Questions You HAVE TO KNOW
13:41
James Q Quick
Рет қаралды 41 М.
Why Linux is better for (most) developers!
14:59
The Linux Experiment
Рет қаралды 460 М.
How JavaScript Ruined the Web
15:02
Eric Murphy
Рет қаралды 108 М.