Replies: 2 comments
-
Having had time for a look around, I think I can leverage the import { setResponse } from '@sveltejs/kit/node';
exports.handler = awslambda.streamifyResponse(
async (event, responseStream, context) => {
const app = new Server(manifest)
const {
rawPath,
headers,
rawQueryString,
body,
requestContext,
isBase64Encoded,
cookies,
} = event
// Some manipulation here
const request = new Request(rawURL, {
method: requestContext.http.method,
headers: new Headers(headers),
body: rawBody,
})
const rendered = await app.respond(request, {
platform: { context },
})
setResponse(responseStream, rendered)
}
) |
Beta Was this translation helpful? Give feedback.
-
It would seem that @geoffrich’s article https://svelte.dev/blog/streaming-snapshots-sveltekit needs an update.
This would appear to be no longer accurate, per https://docs.aws.amazon.com/lambda/latest/dg/configuration-response-streaming.html. I also think that AWS lambda is a significant enough platform to justify a first-party SvelteKit adapter. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I am developing a SvelteKit adapter for AWS (which can be used with different IAC providers).
When I started building the adapter, AWS Lambda was not capable of generating a streamed response, so using SvelteKit's streaming features wasn't possible.
At the beginning of April, AWS announced AWS Lambda response streaming, with a basic example of a handler like so:
Alternatively, they suggest using a
pipeline
as so:My adapter currently handles the request/response handling something like so:
I was just wondering if anyone had any advice on modifying the adapter to use the AWS response stream features, before I need to take a deep dive?
Many thanks for your help,
Mat
Beta Was this translation helpful? Give feedback.
All reactions