Skip to content

Conversation

@khkim6040
Copy link
Member

@khkim6040 khkim6040 commented Jan 7, 2026

배경

#193 의 연장 작업.
dev/prod 환경에서는 S3 credentials(AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)를 사용하지 않아서 환경변수가 없음. 그런데 기존 로직에서는 해당 환경변수 유무로 S3 연결 체크를 했기 때문에 dev 환경에서 S3 연결이 생략되어 데이터를 가져오지 못하는 문제 발생

image

작업내용

S3 credentials는 local 환경일 때만 체크하도록 설정

기존

dev 환경일 때 S3 연결이 생략되어, S3에 있는 설정값을 가져오지 못했음
image

작업 후

잘 가져옴
image

환경변수가 아니라 EC2 인스턴스 IAM Role로 S3에 접근하기 때문. 환경변수는 local에서만 사용됨
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses an issue where S3 connections were failing in dev/prod environments because the credential check logic was incorrectly skipping S3 initialization when AWS credentials were not present as environment variables. In these environments, IAM roles are used instead of explicit credentials.

Key changes:

  • Modified credential validation to only require AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) in the local environment, while allowing dev/prod environments to rely on IAM roles
  • Refactored duplicate S3 enablement checks by introducing a reusable checkS3Enabled helper method that provides consistent logging across all operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


constructor() {
// AWS 자격 증명이 있을 때만 S3Client 초기화
const isLocal = process.env.NODE_ENV === 'local';
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If NODE_ENV is undefined or null, the isLocal check will be false, causing the code to skip credential validation and attempt to use IAM roles. This could lead to unexpected behavior in environments where NODE_ENV is not set. Consider handling the undefined/null case explicitly or defaulting to requiring credentials for safety when the environment is not explicitly specified.

Suggested change
const isLocal = process.env.NODE_ENV === 'local';
const isLocal = !process.env.NODE_ENV || process.env.NODE_ENV === 'local';

Copilot uses AI. Check for mistakes.
@khkim6040 khkim6040 requested a review from hegelty January 7, 2026 04:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants