Handling ResponseStatusException Results in 502
Maintainer thường phản hồi trong vòng 1 ngày
@sapessi đang làm issue này rồi.
Từ ngày 10/7/2020.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
- Framework version: 1.5 / 5.2.6-RELEASE
- Implementations: Spring
Scenario
I am throwing a ResponseStatusException to handle 404's, 500's, etc but no matter when I throw one I am getting the following response with a 502 from the call:
{
"message": "Gateway timeout"
}
This is an example of how I am creating the ResponseStatusException:
if(queryResults.getSize() == 0) {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Unable To Find User for Email Address %s", email));
} else {
// Do something else
}
I am seeing the following in my logs so I know the exception is being thrown properly:
2020-05-04 21:20:04 f1ab9c4e-75ee-457f-b222-dedc69daf8f5 ERROR LambdaContainerHandler - Error while handling request
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.web.server.ResponseStatusException: 404 NOT_FOUND "Unable To Find User for Email Address [email protected]"
It doesn't seem to handle the ResponseStatusException being thrown. I added the following to my application config class:
/*
* optimization - avoids creating default exception resolvers; not required as the serverless container handles
* all exceptions
*
* By default, an ExceptionHandlerExceptionResolver is created which creates many dependent object, including
* an expensive ObjectMapper instance.
*
* To enable custom @ControllerAdvice classes remove this bean.
*/
@Bean
public HandlerExceptionResolver handlerExceptionResolver() {
return new HandlerExceptionResolver() {
@Override
public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) {
return null;
}
};
}
Shouldn't the container handle the ResponseStatusException automatically?
Thanks,
Steve
Expected behavior
The proper response code and response returned
Actual behavior
Always retuning a 502 and Bad Gateway reponse
- Ngôn ngữ chính
- Java
- Star
- 1.6k
- Fork
- 575
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 12
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/serverless-java-container
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
aws/serverless-java-container#1729 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
aws/serverless-java-container#1715 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Support for API Gateway mTLS clientCert fieldCó thể đã có người làm @2748109647 đã nhận 10 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
aws/serverless-java-container#1726 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
aws/serverless-java-container#1579 · 3 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
aws/serverless-java-container#1568 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/serverless-java-container
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
ls1intum/thesis-management#1473 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
LunaDeerMC/Dominion#301 · 1 bình luận ·
-
[FEATURE] Expose external refresh, node-level translog and warmer statsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởuntriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
opensearch-project/opensearch-prometheus-exporter#680 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100