wan2land / serverless-nuxt

AWS Lambda + Serverless + Nuxt = Serverless Nuxt 🚀🚀

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't serve static files from /static folder

ferdinandfrank opened this issue · comments

It seems like files (images, robots.txt, ...) can't be served from the Lambda and the API gateway that is located in the Nuxt project's /static folder.
E.g., I do have a valid robots.txt file located in /static/robots.txt that can be served locally using npm run dev:
image

But in production only a random string is being send:
image

The same applies for any image located in the /static folder.
Can someone reproduce the issue or did I miss a step in the setup?

The txt file also seems to be transferred to base64. I'll test it and talk again. :-)

The bug could not be reproduced.

Please provide the API Gateway settings(AWS > API Gateway > Settings > Binary Media Type) and serverless.yml. 🙏

@wan2land Thanks for your time! The weird thing is that it now works on my DEV environment but not on my PROD environment. Since it's exactly the same code the issue can't be caused by the package, so sorry for that!
My guess is a weird caching issue on CloudFront and the API Gateway, I wasn't able to solve yet. The only purpose of the CloudFront distribution in front of the API Gateway is to redirect http to https.
I already invalidated the cache there, but that didn't fix it either.
I can't really tell the reason for that by the response headers either:
image

The page with the robots.txt is the following: https://spoferan.com/robots.txt.
But since the issue isn't caused by this plugin, feel free to close the issue. ;)