CodeGenieApp / CodeGenieApp/serverless-express

Lambda@Edge origin response event errors out with 502 error because read-only header was deleted

Đang mở
#369 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
JavaScript
Star
5.3k
Fork
676
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

The Cloudfront request responds with:
```The Lambda function result failed validation: The function tried to add, delete, or change a read-only header. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.```

From CloudWatch logs:
```ERROR Validation error: Lambda function result failed validation, the function tried to delete read-only header, headerName : Transfer-Encoding.```

I've figured out a workaround that is to just copy the header manually, but I wonder if the library should've taken care of that itself?

```js
import { getCurrentInvoke } from '@vendia/serverless-express';

router.get('/*', (req, res) => {
const { event } = getCurrentInvoke();

if (event.Records[0].cf.response.headers['transfer-encoding']) {
res.setHeader(
'Transfer-Encoding',
event.Records[0].cf.response.headers['transfer-encoding'][0].value,
);
}
```

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.