This is how you can run async jobs in Next.js with server actions

  Рет қаралды 7,010

Web Dev Cody

Web Dev Cody

Күн бұрын

Пікірлер: 35
@SeibertSwirl
@SeibertSwirl Жыл бұрын
Good job babe!!! Also 160k that’s awesome! I’m so proud of you ❤
@PraiseYeezus
@PraiseYeezus Жыл бұрын
How much have you learned about web development just from watching the videos and talking to Cody? You guys are goals lol
@shubhamrasal8930
@shubhamrasal8930 Жыл бұрын
Thanks for the tip man! I had an issue similar to this where I had to wait for a blockchain transaction to confirm. I just wrapped it into an async call and now I update the UI appropriately.
@Nurof3n_
@Nurof3n_ Жыл бұрын
one extra case you should handle with this approach is if the lambda is being killed before it finishes processing, maybe set a timeout and rerun job or set as failed. I know it doesn't happen often but it's annoying when it does, that's why I use inngest to handle async jobs (but like you said it adds complexity and cost)
@usman3c
@usman3c Жыл бұрын
Congratulations on 160k 🎉🙂
@codinginflow
@codinginflow Жыл бұрын
This looks really cool. So these server actions do execute concurrently?
@WebDevCody
@WebDevCody Жыл бұрын
It seems like it, but I guess it depends on where you deploy
@PraiseYeezus
@PraiseYeezus Жыл бұрын
Would love a video about how you do local AWS development. Besides from deploying to Amplify, I find AWS feels way more complicated than just using a library to call an API with proper credentials
@teamvashmmo3218
@teamvashmmo3218 Жыл бұрын
He uses SST and has made lots of vids about it
@Peacemaker.404
@Peacemaker.404 Жыл бұрын
hey cody great video and i have a question does this app work for videos with chapters and those without? For instance, this particular video has chapters but some doesn't or it generates chapters from scratch based on transcripts?
@WebDevCody
@WebDevCody Жыл бұрын
It uses the transcripts to generate chapters, so it doesn’t use existing chapter knowledge at all
@Peacemaker.404
@Peacemaker.404 Жыл бұрын
@@WebDevCody thanks for replying, i use yt-dlp.
@AndreasStraub
@AndreasStraub Жыл бұрын
Cool, i thought the function would be interrupted in Nextjs after return. Good to know. But can you really always rely on it, that that the background function is not being interrupted? By the way: the react-query has a build-in poling feature. Don’t need to use a custom setInterval stuff
@WebDevCody
@WebDevCody Жыл бұрын
I think it’s because the server action returns the data to the client but the JavaScript promise will still stay on the event queue even after returning the response.
@rajusharma823
@rajusharma823 Жыл бұрын
Yeah that was a great analogy 😅
@IvanRandomDude
@IvanRandomDude Жыл бұрын
Isn't using serveless for things like this bad idea? Lambdas will be long running and that's what costs the most, compute time.
@WebDevCody
@WebDevCody Жыл бұрын
It’s a bad idea when it becomes a cost problem. For most apps it won’t be
@rand0mtv660
@rand0mtv660 Жыл бұрын
That's an interesting idea, but as you mentioned something more robust or reliable would probably have to be implemented in the long run. Btw, I thought you switched to Remix and moved away from Next.js. How come you are using Next.js again? Did I miss a video of you explaining why you stopped using Remix?
@WebDevCody
@WebDevCody Жыл бұрын
I still like remix, but at this point I just rather stick to the framework I’m familiar with so that I don’t have to keep context switching on my side projects. It’s annoying working on a next project and then switching to a remix one back and forth
@rand0mtv660
@rand0mtv660 Жыл бұрын
@@WebDevCody ok yeah makes sense. Probably way more productive that way.
@kecserto
@kecserto Жыл бұрын
I think this is an awesome usecase for SSE (push updates to the UI, showing the current step of processing the video, handling errors). Probably not that easy to implement with next's app router tho I am not sure about that.
@jakubmatousek9429
@jakubmatousek9429 Жыл бұрын
Simple pooling is absolutely fine, just keep an eye on the performance as your user base grows. Once it's necessary becouse of reasons, re-implement. Most likely, there won't be reasons.
@MrTadsuki
@MrTadsuki Жыл бұрын
Do you mind sharing your vscode theme and font?
@reubence_
@reubence_ Жыл бұрын
Question: Wouldn't something like React-Query pull in optimistic data changes automatically?
@WebDevCody
@WebDevCody Жыл бұрын
That would help with the initial delay between hitting the button and waiting for the job to finish, but regardless we need the api response to be fast so we can get the job id otherwise we don’t know what to refresh
@neociber24
@neociber24 Жыл бұрын
Doesn't NextJS kill the job when you refresh the page? I didn't know we can let the lambda run like that.
@WebDevCody
@WebDevCody Жыл бұрын
I’d need to verify, but I don’t remember it killing the request
@freqbac1548
@freqbac1548 Жыл бұрын
What theme extension are you using? Thanks for the videos.
@WebDevCody
@WebDevCody Жыл бұрын
Bearded theme stained blue
@DouglasSouza-wo9rp
@DouglasSouza-wo9rp Жыл бұрын
you can share your json user settings?
@ayushgogna9732
@ayushgogna9732 Жыл бұрын
back to nextjs ? from remix
@medAmineRg
@medAmineRg Жыл бұрын
thats why everyone should know the architecture of languages before start coding.
@iSnakeBuzz
@iSnakeBuzz Жыл бұрын
protip: With cloudflare workers you have websockets at the edge.
@WebDevCody
@WebDevCody Жыл бұрын
Oh nice
@drewbird87
@drewbird87 Жыл бұрын
websprockets 😁
Is your trademark STRONG or WEAK?
11:44
Faith Mitton, Esq.
Рет қаралды 272
React Server Components: A Comprehensive Breakdown
52:42
Theo - t3․gg
Рет қаралды 101 М.
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
火影忍者一家
Рет қаралды 130 МЛН
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 120 МЛН
pumpkins #shorts
00:39
Mr DegrEE
Рет қаралды 123 МЛН
This is why learning typescript generics is important
13:19
Web Dev Cody
Рет қаралды 25 М.
If I had to host on a single VPS, this is how I'd do it
9:35
Web Dev Cody
Рет қаралды 25 М.
A subscriber said my website was slow, so I improved it
5:35
Web Dev Cody
Рет қаралды 1,4 М.
What services might you need when building a SaaS product?
13:58
Web Dev Cody
Рет қаралды 47 М.
This is an INDUSTRY STANDARD for protecting your data
8:49
Web Dev Cody
Рет қаралды 11 М.
How to scale a web application to a million users in 10 steps
0:57
Software Nerd
Рет қаралды 37 М.
Is SST even a good choice to deploy Next.js?
15:57
Web Dev Cody
Рет қаралды 19 М.
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 222 М.
Next 14 + React Query COMBO with Server Actions and RSC
9:49
developedbyed
Рет қаралды 111 М.
哈哈大家为了进去也是想尽办法!#火影忍者 #佐助 #家庭
00:33
火影忍者一家
Рет қаралды 130 МЛН