Deploy a Nest.js App With Serverless (Cheap & Easy)

แชร์
ฝัง
  • เผยแพร่เมื่อ 3 ธ.ค. 2024

ความคิดเห็น • 67

  • @mguay
    @mguay  9 หลายเดือนก่อน

    Get my highly-rated Udemy courses at a discount here: michaelguay.dev/udemy/

  • @macombus269
    @macombus269 2 ปีที่แล้ว +2

    This video tutorial filled all the gaps in my knowledge, thanks

  • @eltondeveloper1159
    @eltondeveloper1159 2 ปีที่แล้ว +2

    Excellent explanation. Great tutorial! I would like that you post tuto about Nest JS + (S3/SQS/SNS) please!

  • @Brandon100
    @Brandon100 ปีที่แล้ว

    Super helpful video! Thanks Michael

  • @pavelvysoudil7185
    @pavelvysoudil7185 2 ปีที่แล้ว +5

    Hello,
    thank you so much for tutorial and knowledge you shared! I am working with similiar app architecture and i have problem with implementing swagger into that architecture. Can you give me any tips? Because Swagger is generating documentation only with endpointurl/{+proxy} but not with full controllers actions. Thank you

  • @carlosmoliveira
    @carlosmoliveira 3 หลายเดือนก่อน

    Great video as always, Michael! Would you consider making a video on how to handle serverless within a microservices application inside a monorepo?

    • @RakulAGN
      @RakulAGN 3 หลายเดือนก่อน

      facing same issue because of node modules are shared

  • @turhanoz
    @turhanoz 2 ปีที่แล้ว +10

    Thanks for the tutorial 👍 well explained and instructfull!
    In this example, the entire monolithic nestjs app is deployed in a single lambda, which handles multiple modules and routes (users, coinbase & auth).
    By any chance, do you have an example of splitting the project into a nest monorepo and deploying a lambda per ressources (in this case, 3 lambdas) with serverless?
    Thank you !

    • @mguay
      @mguay  2 ปีที่แล้ว +6

      Not yet, but maybe an idea for a future video.

    • @melchhepta
      @melchhepta 2 ปีที่แล้ว +2

      would love to see distributed serverless (microservices) nestjs apps with kafka

    • @carlosmoliveira
      @carlosmoliveira 3 หลายเดือนก่อน

      Hey everyone! I was asking the same thing, haha. I know this video is two years old, but does anyone have an example of implementing serverless in a microservices architecture within a monorepo?

  • @muratasarslan2359
    @muratasarslan2359 2 ปีที่แล้ว +1

    Thank you Michael, very well. Is there a video for the things to be done in AWS?

  • @hakanaki
    @hakanaki ปีที่แล้ว +1

    Thank you for this tutorial, I found it really helpful. Is there a way to deploy a nestjs app with web socket and api gateway ?

  • @overrevvv
    @overrevvv 11 หลายเดือนก่อน

    Thanks for this really helpful tutorial.

  • @lardosian
    @lardosian 2 ปีที่แล้ว +4

    Lovely stuff Michael, not many of these types of more advanced tutorials around. One quick question, does Serverless take care of the AWS side of things, as in creating an account and services etc, thanks a lot.

    • @mguay
      @mguay  2 ปีที่แล้ว +4

      Thanks a lot! Serverless will indeed take care of everything. You just need to make sure you have configured your AWS credentials to use the Serverless CLI. You can configure them by running "aws configure" on the command line.

    • @lardosian
      @lardosian 2 ปีที่แล้ว

      @@mguay Thanks again!

    • @firaskudsy
      @firaskudsy 2 ปีที่แล้ว

      @@mguay i did the aws configure but am keep getting error on the sls deploy:
      Error:
      CREATE_FAILED: MainLambdaFunction (AWS::Lambda::Function)
      Resource handler returned message: "null (Service: Lambda, Status Code: 403,

  • @olegamusic9485
    @olegamusic9485 2 ปีที่แล้ว +1

    Will it be possible to deploy NESTJS to Notlify in this way?

  • @carlosrocha5776
    @carlosrocha5776 2 ปีที่แล้ว +1

    Hi Michael, Can you exaplain this method with sqs lambda?

  • @napokhan
    @napokhan ปีที่แล้ว

    thk you. its very helpful for me!

  • @ChibuezeLawsonLoctech
    @ChibuezeLawsonLoctech ปีที่แล้ว +1

    Hi Mike. Thanks Well explained. I keep getting this error when I deploy "Cannot read file node_modules\serverless-offline
    ode_modules\fs-extra\lib\json\output-json.js due to: EMFILE: too many open files" kindly assist

  • @firaskudsy
    @firaskudsy 2 ปีที่แล้ว

    can you share the required steps on the AWS side ? what are the needed user permissions? any steps to implement on the AWS that are needed more than getting the credentials ?

  • @rakulagn4598
    @rakulagn4598 3 หลายเดือนก่อน

    when uploading the package the size is around 116mb so i can’t able to add the nest app into lamda because of the size

  • @mohitsinghjamnal3425
    @mohitsinghjamnal3425 2 ปีที่แล้ว +3

    Do you know, how to integrate swagger in serverless?

    • @basilmbonu6653
      @basilmbonu6653 ปีที่แล้ว

      @Mohit Singh Jamnal were you able to find a solution for this? I am currently having the same issue

  • @kejo-01
    @kejo-01 2 ปีที่แล้ว

    Thanks! This was super helpful

  • @김민종-n7f
    @김민종-n7f 2 ปีที่แล้ว

    It's an amazing video. thank you

  • @OrientalGroveWhispers
    @OrientalGroveWhispers ปีที่แล้ว

    Thanks for the amazing tutorial, in my case i am using postgres how do i connect it

  • @antonkorniievskyi617
    @antonkorniievskyi617 ปีที่แล้ว

    thx a lot for this awesome tutorial

  • @Victor-ku1es
    @Victor-ku1es ปีที่แล้ว

    Do I understand this right? The whole API is running on one single Lampda?

  • @Varuag89b
    @Varuag89b 2 ปีที่แล้ว +1

    Thanks for posting this, Great stuff..
    Couple of queries though :
    How do we handle cold start?
    And can you add how you added custom domain as API gateway url changes on each deployment
    Thanks

    • @mguay
      @mguay  2 ปีที่แล้ว +2

      Thanks! Cold starts are an unavoidable downside to this approach, however take a look at this plugin: www.serverless.com/plugins/serverless-plugin-warmup
      For a custom domain, take a look here: www.serverless.com/blog/serverless-api-gateway-domain/

  • @MartinPerez-mi1ty
    @MartinPerez-mi1ty ปีที่แล้ว

    How to implement a lambda per controller method

  • @ruchi3401
    @ruchi3401 10 หลายเดือนก่อน

    I got problem when I do "sls deploy --stage prod" , It takes .env variable instead of .env.prod. Please help me how to use .env.prod variables

  • @AngelReyes-lo4lh
    @AngelReyes-lo4lh ปีที่แล้ว

    thanks for the tutorial , because ,when execute endpoint response: Error: Cannot find module 'node:url' , Why ??

  • @mox05
    @mox05 2 ปีที่แล้ว

    10:29
    I can see that each request started a new nest/express server which took about a second.
    So why is the cached server you created at 3:55 not working?

    • @mguay
      @mguay  2 ปีที่แล้ว

      Hey there, I think this is a symptom of the Serverless offline plugin. I just checked the logs for my app deployed to the prod stage and I can see the START & END of each request without the server starting up again. Try deploying to prod and giving this a try.

  • @randeepyasintha140
    @randeepyasintha140 11 หลายเดือนก่อน

    Hey, i learned a lot from this video, could give me a hand with a error that im trying to fix? after deploying the project to lambda , i get a "Possible EventEmitter memory leak detected." error message via logs and API endpoints does not work anymore. it just indicates 500 error whenever i try to access one of em. thank you

  • @gilbertopsantosjr
    @gilbertopsantosjr ปีที่แล้ว

    I'm able to run the serverless however the server keep listening it never goes down and start it again when next invoke is requested ... do you know why ?

  • @sandunmadushan1732
    @sandunmadushan1732 2 หลายเดือนก่อน

    great. thank you

  • @michaelamir25
    @michaelamir25 2 ปีที่แล้ว

    What about the database? Is this is suitable for connecting and querying a database in every request? Or it would be slow or unreliable? 🤔

    • @mguay
      @mguay  2 ปีที่แล้ว

      This is something I still have to test out, but check out: docs.nestjs.com/faq/serverless#runtime-optimizations

  • @AbdulHanan-dx3cr
    @AbdulHanan-dx3cr ปีที่แล้ว

    I'm getting 504 lambda timeout, kindly guide me michael

  • @andresfcuellarc
    @andresfcuellarc 2 ปีที่แล้ว

    Thanks so thankful, how do you learn these things?

    • @mguay
      @mguay  2 ปีที่แล้ว

      Lots of experimenting around and trial + error!

  • @RedStone576
    @RedStone576 ปีที่แล้ว

    sheeesh nice theme

  • @IrgyA
    @IrgyA หลายเดือนก่อน

    it will best if you create gcf version

  • @aleksanderbaszkiewicz536
    @aleksanderbaszkiewicz536 2 ปีที่แล้ว

    Hey. There is one thing I don't understand:
    I thought that after prolonged time period of lambda inactivity (like 10 minutes) it shuts down and then next request has to do what is called "cold start".
    As I watched this video, it looks like every request does cold start. Isn't there an option to keep lambda "hot" for X minutes?
    Use case: my app is used rarely but when it is used, I expect it to perform fast.

    • @mguay
      @mguay  2 ปีที่แล้ว

      I’m going to create a video on how to get around this using the Serverless Warmup plugin.

    • @aleksanderbaszkiewicz536
      @aleksanderbaszkiewicz536 2 ปีที่แล้ว

      @@mguay I didn't mean to keep lambda warm during certain time ranges.
      What is confusing me is that in 10:29 we can see you sent 2 requests and app started 2 times. I thought that app starts when first request hits and then it is ready to take requests for like next 10 minutes and then it shuts down.

    • @aleksanderbaszkiewicz536
      @aleksanderbaszkiewicz536 2 ปีที่แล้ว

      Ahhhh I see someone commented with same question and you said that in prod environment it uses cached server

  • @shaiqkar
    @shaiqkar 2 ปีที่แล้ว

    Amazing content man 👏. Can u suggest any resources on creating microservices using serverless and nest js. Each microservice will be a nest js app.

    • @mguay
      @mguay  2 ปีที่แล้ว +1

      I do have a video on Nest.js Microservices - check it out. I think you could combine these two approaches.

  • @marlonmonsalve3324
    @marlonmonsalve3324 2 ปีที่แล้ว

    hi, you can say what extensions for serverless in vscode?

  • @mareklewandowski9368
    @mareklewandowski9368 2 ปีที่แล้ว

    6:35 no multicursor, ngmi :D

  • @debatreesarkar7126
    @debatreesarkar7126 2 ปีที่แล้ว

    Hi,
    This video is very helpful. Thank you!
    But I got stuck at the last step. I am getting the below error while running sls deploy command.
    Error:
    self signed certificate in certificate chain
    Can you please help me to find a solution for this?

    • @Realnoooob
      @Realnoooob 8 หลายเดือนก่อน

      I found a solution

  • @rafaelbonin3363
    @rafaelbonin3363 2 ปีที่แล้ว

    I had a problem with timeout because i am using a aws rds mysql db so i had some ping. i fixed it just by adding "timeout: 45" under the handler key in serverless.yaml file

  • @MrDIiSiMuLaLo
    @MrDIiSiMuLaLo 2 ปีที่แล้ว

    Thank you so much man, this is amazing! could you make a video using webpack to solve the cold start?? I founded un the Nestjs doc but its not working for me, I'm going crazy with this.. thank you so mucho for this anyway

    • @mguay
      @mguay  2 ปีที่แล้ว +1

      Sure thing!

  • @zeeshanahmadkhalil8920
    @zeeshanahmadkhalil8920 ปีที่แล้ว

    We need AWS account for that which is not free.

    • @mguay
      @mguay  ปีที่แล้ว

      Sure but this approach is much cheaper than using something like Heroku if you’re app doesn’t get a ton of traffic.

  • @GallifreyHeritage
    @GallifreyHeritage 2 ปีที่แล้ว +1

    I downloaded the git code and it doesn't work. When using the "yarn build + sls offline" it says offline is not a function.
    I tried to follow the same steps with a new nestJs project and it didn't work either, first I had to put: "path: '/{proxy+}'" in the serverless.yml for it to recognise it; and even then, it gives the following error:
    (0 , serverless_express_1.configure) is not a function

    • @asifadam93
      @asifadam93 2 ปีที่แล้ว

      Same here

    • @joshuaokoro9447
      @joshuaokoro9447 11 หลายเดือนก่อน

      Try using this package @codegenie/serverless-express. I was having the same issue and I was able to resolve it after I found out they rename the package.

  • @pedromanuelsalasgalindo3219
    @pedromanuelsalasgalindo3219 2 ปีที่แล้ว

    thanks for the tutorial man you are a fucking god but when i use the command sls offline sendme this error
    ✖ Unhandled exception in handler 'main'.
    ✖ (0 , serverless_express_1.default) is not a function