-
Notifications
You must be signed in to change notification settings - Fork 5
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
Decide approach to code splitting / routing #12
Comments
Hey @juranki I understand that you use one Lambda@Edge function whose handler imports the whole SvelteKit app, does SSR when necessary, otherwise just instructs CloudFront to provide the pre-rendered page. Could you please help to understand
Thanks! And please keep up the good work! This is the only AWS adapter working with the latest sveltekit version out in the wild - afaik. Cool! |
Correct.
The primary reason is the mechanism Lambda@Edge provides for handling pre-rendered pages. Secondary reasons include simplicity and less network hops, thus potentially smaller latency (haven't measured though) There is a potential for hitting the quotas. The relevant ones are response size (1 MB) and compressed size of the handler (50 MB). For most use cases those should be reasonable, although it's easy to come up with cases that could be problematic.
With many small functions you can possibly reduce startup time and avoid function size quota, but at the same time the number of cold starts increases. Pick your poison :)
Yes, and currently I think this is in some-day-maybe category. The complexity is significant and I'm not sure if it's possible to map SvelteKit routes to CloudFront behaviour patterns. |
Great work on this. I'm still trying to learn Sveltekit and dive deeper into CDK, so take my points with this in mind. I am starting at the end (i.e. deployment) because this has become my natural way of thinking.
|
Hello @aihaddad,
|
Thank you @juranki Regarding point 2, Lambda@Edge is definitely the better/best/only option for pre-rendered static and client pages, I was referring more to SSR. Basically everything beyond line 38 (as far as I understand) where it can probably be delegated to another Lambda, and that's the one where the choice can be given |
sveltejs/kit#2931
The text was updated successfully, but these errors were encountered: