Function URL invoke hangs when the response stream is empty

Aperta
#95 7 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
aws, node.js, typescript
Ambito
api, backend, cloud

Direzione di ricerca

Inizia con la riproduzione in index.cjs usando awslambda.streamifyResponse, HttpResponseStream.from, pipeline e Readable.from(Buffer.alloc(0)) in un’invocazione di Function URL. Eseguila in us-east-1 e confronta il comportamento degli account più vecchi e più nuovi. Il lavoro è completato quando uno stream di risposta vuoto con statusCode 403 chiude la connessione del client invece di rimanere bloccato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
224
Fork
60
Merge medio
26m
PR unite (30g)
2

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di aws/aws-lambda-nodejs-runtime-interface-client

Tutte le issue di aws/aws-lambda-nodejs-runtime-interface-client

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.