fix: 빌드 시점 환경변수 검증 오류 수정#64
Conversation
모듈 로드 시 throw하던 환경변수 검증을 fetchApi 호출 시점으로 이동하여 .env 없는 환경에서도 pnpm build가 통과되도록 수정. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary of ChangesHello @Jieunsse, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 Pull Request는 빌드 시점에 환경변수 유효성 검사로 인해 발생하던 오류를 해결합니다. 기존에는 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 PR은 빌드 시점이 아닌 API 호출 시점에 환경 변수 유효성을 검사하도록 수정하여, .env 파일이 없는 환경에서도 빌드가 성공하도록 변경했습니다. 전반적으로 좋은 수정이며, 의도한 대로 잘 동작할 것으로 보입니다. 한 가지 개선 제안으로, 환경 변수 검증 로직에서 여러 변수가 누락되었을 경우 모든 누락된 변수를 한 번에 알려주도록 에러 메시지를 개선하는 것을 제안합니다. 이렇게 하면 설정 오류를 디버깅할 때 더 편리할 것입니다.
| if (!BASE_URL) throw new Error('NEXT_PUBLIC_API_BASE_URL is not defined.'); | ||
| if (!TEAM_ID) throw new Error('NEXT_PUBLIC_API_TEAM_ID is not defined.'); |
There was a problem hiding this comment.
두 환경 변수를 각각 확인하는 대신, 한 번에 확인하여 누락된 모든 환경 변수를 에러 메시지에 포함시키는 것이 좋습니다. 이렇게 하면 설정 문제를 디버깅할 때 한 번에 모든 누락된 변수를 파악할 수 있어 더 효율적입니다.
const missingVars: string[] = [];
if (!BASE_URL) {
missingVars.push('NEXT_PUBLIC_API_BASE_URL');
}
if (!TEAM_ID) {
missingVars.push('NEXT_PUBLIC_API_TEAM_ID');
}
if (missingVars.length > 0) {
throw new Error('Missing required environment variables: ' + missingVars.join(', '));
}
Summary
모듈 로드 시 throw하던 환경변수 검증을 fetchApi 호출 시점으로 이동하여
.env 없는 환경에서도 pnpm build가 통과되도록 수정.