ES /docs

failed to get element records - error: 500 Internal Server Error

Service
cupixworks-api
Occurrences
2
Status
Reported
Confidence
85%
Actionability
36%
Cluster ID
ce4eeccc-911a-4ec9-9f4d-331c4fa660a8
First Seen
2026-07-16 13:19 UTC
Last Seen
2026-07-22 13:27 UTC
Actions

failed to get element records - error: 500 Internal Server Error

What Happened#

2026-07-16 22:19:52 KST에 cupixworks-apiGET /api/v1/siteinsights/element_records 요청 1건이 502로 응답했다. Cupix::SiteinsightsService.get_element_records! 가 downstream siteinsights-service Lambda 를 호출했으나 Lambda 가 500을 반환했고, 그 원인은 캐시된 MongoDB(DocumentDB) 커넥션에서 발생한 ERR_STREAM_WRITE_AFTER_END(write after end) 였다. 6분 뒤(22:25:28 KST) 동일 Lambda 의 bulkElementRecords 에서도 같은 원인의 오류가 재현되어, 단일 호출 실패가 아닌 warm container 의 커넥션 상태 문제로 확인된다.

Quick Facts#

Field Value
exception.class Cupix::Errors::System
exception.message failed to get element records - error: 500 Internal Server Error
top_frame app/services/cupix/siteinsights_service.rb:122
downstream root cause ERR_STREAM_WRITE_AFTER_END in siteinsights-service Lambda (MongoDB driver)
top_frame (downstream) applications/siteinsights-service/functions/api/ElementRecord.ts:254
error_code SYS20000
http status 502 (API 응답), 500 (Lambda 응답)
env production, us-west-2

Affected Teams#

Team / Domain Error Count Impact
siteinsights (element_records) 2 6분 간격으로 GET /element_records 1회 및 PUT /element_records/bulk 1회 실패. 사용자 관점에서는 element_records 조회/저장이 각 1회 502 로 실패. 재시도 시 성공 (인접 200 응답 다수 확인).

Timeline#

  1. 2026-07-16 22:19:52 KSTsiteinsights-service Lambda 의 getElementRecords 가 캐시된 MongoDB 커넥션으로 countDocuments 를 호출하려다 write after end 로 실패, 500 반환. cupixworks-api 는 이 응답을 Cupix::Errors::System 으로 변환하여 502 로 사용자에게 전달 (본 RCA 대상 이벤트).
  2. 2026-07-16 22:25:28 KST — 동일 Lambda 의 bulkElementRecords 에서 Error [ERR_STREAM_WRITE_AFTER_END]: write after end 재발. 같은 warm container 의 캐시된 커넥션 상태 문제로 판단됨.
  3. 2026-07-16 22:25:30 KSTcupixworks-api 에서 bulk_element_records! 500 에러가 상위 서비스로 전파.
  4. 2026-07-16 22:19:53 ~ 23:28:06 KST — 이후 동일 엔드포인트의 요청들은 200 으로 정상 응답 (Datadog 로그에서 다수 확인). 재발 없음.

Scoring#

Confidence 85% · Actionability 36%

Confidence#

Dimension Score Detail
Evidence completeness 5/5 15 code refs, 5 log queries
Code path explicitness 3/3 15 file:line refs
Log evidence 3/3 section, query, pattern
RCA structure 3/3 3/3 sections
Revision history 0/3 0 revision(s)
Agent execution 3/3 success

Actionability#

Dimension Score Detail
Fix complexity 1/5 critical
Affected files 1/5 13 file(s)
Single repo 1/3 3 service(s)
Immediate actions 0/3 absent
Testability 2/3 test mentioned
External dependency 1/3 external deps found
Data migration 3/3 no migration