This Is The Way.. Next.js Server Actions with next-safe-action & Sentry

  Рет қаралды 3,105

Dave Gray

Dave Gray

Күн бұрын

Пікірлер: 34
@DaveGrayTeachesCode
@DaveGrayTeachesCode 18 күн бұрын
Use the code "davegray" for 3 months free on the Team plan of Sentry for any new accounts: bit.ly/try-sentry-dg
@oladapooluwadurotimi2865
@oladapooluwadurotimi2865 18 күн бұрын
Well done sir. Nice course ❤.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 18 күн бұрын
Thank you!
@Quinn55455
@Quinn55455 11 күн бұрын
Great job explaining Dave, thanks again for another good tutorial!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 7 күн бұрын
Glad you enjoyed it!
@SkyrimBeast
@SkyrimBeast 17 күн бұрын
3rd to comment. Thanks Dave, your video's have been an invaluable resource 🙂
@DaveGrayTeachesCode
@DaveGrayTeachesCode 17 күн бұрын
I appreciate that! 🙏
@Elizabeth-h8l5x
@Elizabeth-h8l5x 12 күн бұрын
Great content, as always! I need some advice: I have a SafePal wallet with USDT, and I have the seed phrase. (alarm fetch churn bridge exercise tape speak race clerk couch crater letter). Could you explain how to move them to Binance?
@YabseCoder
@YabseCoder 16 күн бұрын
Great job , Professor we gonna hit 1M in 2025 hopefully sir ❤
@vispz
@vispz 17 күн бұрын
Thank you, Sir. I owe the knowledge I have to you. I hope that one day I can support you in return ❤.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 17 күн бұрын
Glad I have helped!
@vispz
@vispz 17 күн бұрын
@@DaveGrayTeachesCode ❤
@MyGeorge1964
@MyGeorge1964 17 күн бұрын
Nice course, thank you. Have you thought of adding a multi-language component to this project?! Just asking...
@DaveGrayTeachesCode
@DaveGrayTeachesCode 17 күн бұрын
Good suggestion! It won't be part of the core series, but I have several features that I plan to do short add-on series for this after the main series is finished.
@MyGeorge1964
@MyGeorge1964 17 күн бұрын
@@DaveGrayTeachesCode Great! Many thanks.
@ilan117
@ilan117 16 күн бұрын
Hi Dave, I am not very sure that’s the best error handling. I never used next-safe-action before but with the tools I am usually using I could prompt the user on a form that an entry e.g. a phone or an email is already existing. Now having this done your way, if for example you try to create a customer with existing email or phone the user is prompt with the following message “Database Error: Your data did not save. Support will be notified“, I am doing something wrong?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 16 күн бұрын
@@ilan117 No you're not doing anything wrong. You can absolutely look for specific errors and give tailored messages to the user if you want to. You could even be more proactive and provide that information immediately like GitHub does when you create the name of a repository. At some point I have to stop with features or the tutorial would go on forever. Please make it your own as you go. That said, I may add your request in before the series ends. I can see how it is desirable. 🙌
@LeonegasHolmes
@LeonegasHolmes 16 күн бұрын
Hi Dave. Thanks for making such well explained videos with up to date concepts. Learn a lot with them. But i have a question. With the new react hook “useActionState” with zod and custom validation, does it still make sense use a library like next safe actions? I know it requires a little more code to make it work but it makes you less dependent on future changes on a external library i think. Thank you again!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 16 күн бұрын
There is always that consideration with any external library. You can create everything from scratch, but libraries help. I currently like and use the patterns established with next-safe-action, but you can forego it if you (or your dev team) decides to.
@celsopires1999
@celsopires1999 6 күн бұрын
Hi Dave, When we try to insert a customer with an existing email address in the database, we get an error. Could you please advise on the best approach for detecting this issue and sending the error message to the client side? Thank you!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 6 күн бұрын
@@celsopires1999 yes, I'll be adding that in the next video I publish (chapter 12).. final changes before deployment.
@mrbilchalan
@mrbilchalan 17 күн бұрын
I thought you will use useActionState instead of next-safe-action. The two hook almost same what I understand still now. Then why we use next-safe-action? Hey, I am still new in this tech and mess up with myself often. Thank you again.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 17 күн бұрын
I think you will see and understand why I chose next-safe-action as you complete the video. I explain why I like it throughout.
@craigmcclanahan8410
@craigmcclanahan8410 2 күн бұрын
Hi Dave, I am really enjoying the content you are presenting in this series. But I ran into a question about what to do if your database table has constraints like "unique" or "foreign key". The Zod schema won't catch this kind of thing. In many of my older apps, I've gotten around this by using async processing in Zod to do the checks as the form is being filled out. In the case here, in the Customers table for example, the uniqueness checks on email and phone will trigger database errors on an INSERT or UPDATE if they are violated. That in turn will cause a relatively meaningless error returned to the user, without any indication of what the actual problem is. It would be a good idea to at least catch these constraint violations to give the user an idea of what they have to fix.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Күн бұрын
That unique duplicate entry error is handled in the video that just published today. Drizzle schemas do support foreign key relations. It just depends on the type of database you're working with.
@craigmcclanahan8410
@craigmcclanahan8410 Күн бұрын
@@DaveGrayTeachesCode Awesome! Looking forward to it.
@AldisSv
@AldisSv 17 күн бұрын
Hello. First of all, thank You for this awesome series. I wonder, why some fields like those optional ones, have .trim(), but others dont? Shouldn't we .trim() all fields? Also, is it really possible to send data to that saveCustommerAction from another source rather than our form? Do we really need validation inside that serverAction if we dont have backend API endpoint which triggers that function?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 17 күн бұрын
@@AldisSv yes, you can trim all fields if you want. I only focused on the optional fields in preference of null over an empty string when the field is not required.
@craigmcclanahan8410
@craigmcclanahan8410 2 күн бұрын
In regards to needing server side validation, you absolutely need to do that. A server action is implemented with a POST call to an endpoint created by the action, without you having to build it. However, this endpoint does NOT have any validations of its own! You will need to check authentication and run schema validations on the server side, just in case someone nefarious has reverse engineered how to call that endpoint (it's not hard to do this) themselves.
@AldisSv
@AldisSv 2 күн бұрын
@@craigmcclanahan8410 Thank You for clarification. Now I get it, server actions generate API endpoints without us explicitly defining them with api folder structure route.js files.
@mrbilchalan
@mrbilchalan 17 күн бұрын
I don't know if you have enough time, Please consider a tutorial for next-auth. I know you have a tutorial about it, but that is not enough for people like me. There are many things like strategy, access token, refresh token, rotation between them and others are not cleared. Thank you.
@hamudxd9497
@hamudxd9497 17 күн бұрын
HELLO SIR PLEASE LAUNCH A COURSE OF NEXT FOR ABSOLUTE BEGINNERS FFOM BASIC TO ADVANCED
@BryanOnyeji
@BryanOnyeji 17 күн бұрын
Really nice course. Sir I've been following all your courses especially your HTML CSS and JavaScript course I've been a devoted fan of your work but recently my laptop just got spoilt and now trying to find new ways to code please if you can assist really appreciate you thank you. Thank you for all the free courses, you've really impacted a lot of teens in Nigeria.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 17 күн бұрын
Glad I've helped you. I'll continue to offer free content but I don't send out laptops.
Search in Next.js with Drizzle ORM | Nextjs Full Stack Project
46:39
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Tuna 🍣 ​⁠@patrickzeinali ​⁠@ChefRush
00:48
albert_cancook
Рет қаралды 148 МЛН
Astro stole my favorite parts of Next (and I'm hyped)
32:30
Theo - t3․gg
Рет қаралды 42 М.
ChatGPT API with Node.js: A Step-by-Step Tutoria
8:10
CarlosdevAi-english
Рет қаралды 56
React 19 STABLE - I Can't Believe They Changed This
11:18
ByteGrad
Рет қаралды 33 М.
Vite 6 is important, here's why
19:35
Theo - t3․gg
Рет қаралды 102 М.
Google’s Quantum Chip: Did We Just Tap Into Parallel Universes?
9:34
It's finally out!!! (Next.js 15 breakdown)
30:06
Theo - t3․gg
Рет қаралды 91 М.
Finally.... But it's exciting!
13:58
Maximilian Schwarzmüller
Рет қаралды 29 М.