Search code examples
amazon-web-servicessveltenetlify

Netlify implementation / hosting of Svelte endpoints (AWS?)


I have set up a REST endpoint (simple http GET) using Sveltekit's endpoints implementation. It works in 'npm run dev' mode when it's running on my computer, but certain requests give errors when hosted on Netlify. The specific error message is straightforward:

{"errorMessage":"Response payload size exceeded maximum allowed payload size (6291556 bytes).","errorType":"Function.ResponseSizeTooLarge"}

I know I can fix this by splitting up and paging results.

My question is: Does Netlify use AWS Lambda to host the compiled Svelte endpoints even if I don't use Netlify's serverless functions explicitly?

I ask because searching this error message gives results about Netlify/AWS lambda, and I'm just curious to know if anyone knows concretely how Netlify handles these svelte endpoints behind the scenes. It really looks like they bundle them into AWS Lambda functions (which they already advertise they are using for their own Netlify functions).


Solution

  • Svelte uses @sveltejs/adapter-netlify under-the-hood: https://www.npmjs.com/package/@sveltejs/adapter-netlify to work on Netlify. This package generates a Netlify Function named render which handles the Server Side Rendering of your Svelte application.

    So to answer your question, yes, you're using Netlify Functions in your project - not yourself, but your framework is doing that for you.