-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploy assets to s3 #4
Comments
I use this Serverless plugin atm :) https://github.com/fernando-mc/serverless-finch I deploy it in my package.json with |
Thank you for the link @lolcoolkat, I'll check it out before I implement something new :) |
I am not sure whether this is what @cyrilwanner was asking..and I have the same problem. I still want to deploy my code to lambda and access it via api gateway, because of SSR and some dynamic URLs. But I want to put all static files (js, css, png, etc) to S3 bucket and prefix all paths to that bucket so browser downloads all this data from S3. If serverless-finch can do this, it's great. But it doesn't seem so from their readme. |
I currently have another project which I have to finish first, but after that, I'll come back to next-serverless and implement the improvements which I have in mind. But I think it should also be possible with serverless-finch (and without modification of next-serverless).
No guarantee as I didn't have the time to try serverless-finch out yet, but I think it could work like that. On the first request, you get the response back from lambda (server-side rendered) and in this response, all other assets point to the s3 url and are used for the client-side navigation. Please let me know if this worked for you or if you experienced a problem somewhere :) I definitely plan to include something like this (e.g. serverless-finch auto configured) into next-serverless to make it easier. |
It won't work as easy as you describe because S3 cannot serve files over https (and you will probably also want custom domain name). You need to setup CloudFront (if we are talking just AWS). But you shouldn't do this inside of your website serverless project if you have more complex infrastructure. Instead this should be probably handled separately using cloud formation, terraform or just manually in AWS console. |
Ah yes, you are right. |
It should be possible to deploy the static assets to s3 if the user wants that.
Ideas:
after:deploy:resources
: Upload .next to s3BUILD_ID
(configurable max number to keep in S3)serverless.yml
(a resource link or bucket name)next.config.js
which automatically sets the assets prefix in lambdanext-serverless deploy
command if necessaryThe text was updated successfully, but these errors were encountered: