How to deploy Express Server on AWS Lambda
HTML-код
- Опубликовано: 23 авг 2024
- Trying to deploy an express server to AWS lambda can be difficult if you don't have a lot of experience with AWS services or if you have never used serverless-http. In this video, I walk you through deploying your express server to a Lambda function and explain the process to show how simple it can actually be.
Tips:
- When deploying the lambda function make sure your index.js file is in your projects root directory
- Make sure you aren't using the base express route. API Gateway will not route this to our lambda function
Resources:
Github Repo: github.com/Vin...
serverless-http: www.npmjs.com/...
Express Docs: expressjs.com/...
My github: github.com/Vin...
My portfolio: www.vinibjazev...
Thx for this tutorial !! Migration from basic nodejs server to aws can't be more easy with your concise explanation !! 👏🏻
Excellent!!, you have saved me, I had several days trying to solve it... Thank you very much for your contribution
Everything very easy and clear to understand and start up
👋👋👋👋👍👍
This was the tutorial I was looking for! You are a superstar!
thank you for making this.
making life easier with deploying super simple crud api
best tutorial i saw about that topoc
thank you so much. this was the simplest tutorial i found on youtube.
Yes, I enjoyed the video. Thanks for asking, or rather hoping
The deployment package of your Lambda function "hotelS3" is too large to enable inline code editing. However, you can still invoke your function.
Awesome!! Thankyou!! got what I was looking for!!
Thanks for you! This video solved my problem.
It worked perfectly! Thanx a lot!!!
This was super clear and helpful! Thank you :) Things seem to be connected on my end, but there's a CORS error that won't go away. any idea? (I enabled it in the gateway)
I figured it out in the end , I had to add CORS headers when the response was being sent, and clear up my routes. This was really great thank you!
would someone explain why the base route doesn't work?
Great tutorial thanks! 👍
Great bro
This is weird I deployed my express server on vercel cloud serverless once and it was working without any issue. Am I to assume that they change the code base automatically?
Hi Vini, thanks for the video! Question, I have a simple Node project that connects to the Binance API using a WebSocket, I want to use AWS to keep the Node project running in the cloud instead of my PC. What should I use? Just a Lambda Function? thanks
You can use pm2 I guess
@@dineshpr thanks for the response. I actually used ec2 and it does the job! Idk if pm2 is more suitable
As a general rule, Lambda is mainly used for short operations. So occasionally if you need to run some code and it only takes a minute to run this is a perfect use case. If it needs to run for long periods of time (greater than 15 min) or always needs to run then we would want to something like a EC2 instance.
How do you serve the frontend with an express app?
Any solution ?
I have a express and postgres backend. The api requires jwt token in headers will this way work
I see serverless-http is no longer being maintained?
hi i have a question can we deploy our old sequelize orm project to lamdba?
Hi Vini,
I'm getting statusCode 404 error I did same as of you, could you please help me to fix it,
"headers" : {
"x-powered-by": "Express",
}
"message": "Internal server error"
Any help?
Same error. Error does not help at all..
Hello! I'm trying to deploy my server. I'm using Prisma, express with routes and controllers with it.
For my client-side i'm using React.
Does this deployment method works for me?
Yeah you shouldn't run into any issues using prisma its just a tool that makes managing your database a little easier. If you run into issues let me know and I could try to deploy an API using it.
file size limit is coming
Super hero🦸
i am getting internal server error
same here have you solved this
@@abdulbasitimtiaz Can you provide a little more information on the error? There is a chance that something is broken in your express server. I would make sure it works locally before trying to deploy it to Lambda.
@laraibanwar1618 did you ever get past your issue?
This video was really helpful for me. When I got the internal server error, I fiddled with a lot of setting but what eventually worked for me was increasing the timeout settings on my Lambda function. The default is 3secs when you create a lambda function. So I went to the "Configuration" tab >> clicked "Edit" and increased the timeout settings to 10s. This can be increased as needed. But in my case, my application was previously timing out within 3secs which was causing the internal server error.
In addition, I moved my environment variables to the Lambda functions interface instead of having them in a .env file within my application.
If you using .js code from repo , notice that it has several changes, for me a walkaround was simply create function URL in aws Lambda configuration.
top