Function URL invoke hangs when the response stream is empty

Abierto
#95 7 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
aws, node.js, typescript
Área
api, backend, cloud

Línea de trabajo

Comienza con la reproducción en index.cjs usando awslambda.streamifyResponse, HttpResponseStream.from, pipeline y Readable.from(Buffer.alloc(0)) en una invocación de Function URL. Ejecútala en us-east-1 y compara el comportamiento de las cuentas antiguas y nuevas. Se considera terminado cuando un stream de respuesta vacío con statusCode 403 cierra la conexión del cliente en lugar de quedarse bloqueado.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I have a lambda with response streaming enabled. Invoked via Function URL. I am trying to return a status code with no response body. I have reduced my code to the below sample to reproduce the issue:

// File: index.cjs
// Handler: index.handler

const pipeline = require("util").promisify(require("stream").pipeline);
const { Readable } = require("stream");

exports.handler = awslambda.streamifyResponse(async (event, responseStream, context) => {
  responseStream = awslambda.HttpResponseStream.from(responseStream, {
    statusCode: 403,
  });

  await pipeline(
    Readable.from(Buffer.alloc(0)),
    responseStream,
  );
});

I can see the HTTP headers are sent correctly and received by the client. But the connection remains open for up to 16 minutes. It seems like the runtime expects a response body, and if there is none, it just hangs and does not close the connection.

What's even stranger is that I have tested this in 2 different accounts. One of the accounts has been created ages ago, and the code above actually works fine as one would expect. The other account is newer (and it's where that code is supposed to run), and it just hangs and doesn't close the connection. Region is us-east-1.

Lenguaje dominante
TypeScript
Estrellas
224
Forks
60
Merge medio
26 min
PR fusionados (30 d)
2

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de aws/aws-lambda-nodejs-runtime-interface-client

Todos los issues de aws/aws-lambda-nodejs-runtime-interface-client

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.