서버리스 Internal Server Error 나 "Unable to import {}".format(config["app"]) 일 때 확인해야 할 것
보통 라이브러리 문제인것 같다.
requirements.txt 에 누락된 것이나 오타가 없는지 한번 확인해보자.
aws lambda 에서 해당 함수의 모니터링 탭을 클릭하면 CloudWatch 에서 로그 보기 버튼을 있는데
이를 통해 어디서 에러가 났는지 좀 더 자세하게 알 수 있다.
https://github.com/logandk/serverless-wsgi/issues/190
[Question] Possible reasons of getting Unable to import core.wsgi.application with Django app? · Issue #190 · logandk/serverle
Got the following error from the API Gateway: Wed Aug 25 14:39:51 UTC 2021 : Endpoint response body before transformations: {"errorMessage": "Unable to import core.wsgi.application&q...
github.com
위 링크에서 글쓴이도 그렇고
람다는 import 과정에서 생긴 오류를
ModuleNotFoundError 라고 리턴해주지 않고
[ERROR] Exception: Unable to import app.ap 과 같이 리턴해주는것 같다....
때문에 이와 같이 람다에서 에러가 발생하였을 때
CloudWatch 의 로그를 꼼꼼히 살펴보는 것이 중요하다.
CloudWatch 의 로그 이벤트 우측에 Display 를 선택 할 수 있는 창이 있는데 모든행 확장을 클릭하면 편하게 볼 수 있다.