aws / aws/aws-lambda-nodejs-runtime-interface-client

Function URL invoke hangs when the response stream is empty

Đang mở
#95 7 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
224
Fork
60
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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:

```js
// 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`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.