|
|
|
Ask HN: Serve static content from serverless AWS lambda function
|
|
4 points
by xameeramir
2438 days ago
|
|
We have an express+React typescript app that is executed from a serverless endpoint which is intended to ultimately move to AWS lambda. The React bundle is served as static content along with its css, js etc files. React app is hosted inside a single serverless project. The same is exposed from serverless.yml config as a function named static-router: static-router:
handler: src/server.handler
events:
- http: ANY /
- http: ANY /{proxy+}
So, on my local, it works absolutely fine! All the static content along with the index.html are getting served to the browser using serverless-offline Static content served However when I push the same to AWS using serverless deploy - all the static content is not getting served. Refer to this link: https://xjfxfyosml.execute-api.ap-south-1.amazonaws.com/dev/ How do I allow serving static content from the Lambda function which were working perfectly on my local? What is missing here? |
|
I can't tell you why this problem is happening but you should consider uploading your static assets to S3, or you'll be paying for compute time when S3 can do it for cheaper or potentially free, and without burning your execution allowance.