CodeGenieApp / CodeGenieApp/serverless-express

Support for Cloudfront as event source

Đang mở
#583 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
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ả

I've got requests passing through a Cloudfront distribution directly to a lambda, no cache, passing all request headers with it. I'm using this approach because API Gateway and ALB are both overkill for my use-case, simply need a public endpoint with custom domain compatibility, hence Cloudfront.

Issue is that this library produces a `Unable to determine event source based on event` error in this setup. Having a look at the code it seems [here](https://github.com/vendia/serverless-express/blob/75cfbffeb3fd030695b9587a75300c7b8012ac6a/src/event-sources/utils.js#L70) that there is no conditional to detect this circumstance.

Since I'm passing all headers directly through Cloudfront, I assume that the event in this case looks a lot like it came directly from the client, rather than something triggered through another cloud service. This seems to me perhaps as a valid default case to design for in this library, in the absence of any other forwarders?

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

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

Hướng nghiên cứu

Bắt đầu tại src/event-sources/utils.js, khoảng dòng 70, nơi việc phát hiện nguồn event hiện đang thất bại đối với request CloudFront-to-Lambda được mô tả. Hãy tái hiện hoặc kiểm tra một event trong đó CloudFront chuyển tiếp tất cả headers, sau đó xác định behavior phát hiện cần thiết cho trường hợp endpoint trực tiếp này. Hoàn tất khi event được chấp nhận mà không có lỗi "Unable to determine event source" và behavior liên quan được bao phủ bởi tests nếu repository cung cấp chúng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
aws, express, javascript, node.js
Lĩnh vực
api, backend, cloud
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

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.