Git Product home page Git Product logo

Comments (5)

johnimholawal avatar johnimholawal commented on July 17, 2024 2

I came here for the same question :)

from serverless-http.

creativityjuice avatar creativityjuice commented on July 17, 2024 2

Hey,
Thanks for your lib πŸ‘
I would also need this feature to increase payloads sizes for some routes of my API.

from serverless-http.

dougmoscrop avatar dougmoscrop commented on July 17, 2024 1

I think not only this, but the Function URL itself is configured for streaming or not. I don't remember if the payload indicates this, otherwise, it has to be a configuration option.

(but yes, supporting streaming here, is something I definitely want to support!)

from serverless-http.

jdrydn avatar jdrydn commented on July 17, 2024

After reviewing Introducing AWS Lambda response streaming, I've just read:

Writing the handler for response streaming functions differs from typical Node handler patterns. To indicate to the runtime that Lambda should stream your function’s responses, you must wrap your function handler with the streamifyResponse() decorator. This tells the runtime to use the correct stream logic path, allowing the function to stream responses.

... I think this means in order to support streaming, all responses would have to be "streamed" regardless if the response is a stream, something like:

import serverlessHttp from 'serverless-http';

 export const handler = awslambda.streamifyResponse(serverlessHttp(app, {
  streaming: true,
}));

And underneath, something like:

async (event, responseStream, context) => {
  responseStream.setContentType("application/json");
  responseStream.write(JSON.stringify(res.body));
  responseStream.end();
}

Even if the final response isn't a stream? I imagine that might be problematic?


Afterthought: It's a shame AWS didn't just iterate on their current APIGatewayProxyResult type, for example:

{
  statusCode: 200,
  headers: { ... },
  body: someReadStream,
  isReadableStream: true
}

from serverless-http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.