fix(next): inline pairing-token env via literal process.env - #16
Merged
Conversation
…outer readEnv read the enabled flag / base URL / pairing token through a dynamic globalThis.process.env[key] lookup, which bundlers cannot statically replace. The Next App Router client bundle has no runtime process object, so the lookup resolved to undefined and the widget never mounted (verified on Next 16 + Turbopack). Switch to literal process.env.<KEY> access so Next env-config inlining substitutes the dev values at build time. Also adds the missing createAgentCommandsFetcher export to the bootstrap test mock (3 pre-existing red tests now green; 27/27 pass).
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
undefined로 평가되어 위젯이 마운트되지 않던 문제 수정process.env.<KEY>리터럴 멤버 접근으로 변경Root Cause
globalThis.process.env[key]동적 조회 방식은 번들러가 컴파일 타임에 정적 치환할 수 없음process객체가 없어 (typeof process === 'undefined') 환경변수 조회가undefined반환Fix
readEnv()함수를 리터럴process.env.<KEY>표현식으로 재작성env-config 인라이닝이 빌드 타임에 dev 값을 치환하도록 수정AGENT_DEVTOOLS_NEXT_ENABLED,AGENT_DEVTOOLS_NEXT_BASE_URL,AGENT_DEVTOOLS_NEXT_PAIRING_TOKEN세 환경변수 모두 리터럴 접근으로 통일Changes
packages/next/src/bootstrap.ts:readEnv()함수의 환경변수 읽기 로직을 동적 조회에서 리터럴 멤버 접근으로 변경packages/next/src/bootstrap.test.ts:createAgentCommandsFetcher스파이 추가 (테스트 커버리지 강화).changeset/next-bootstrap-literal-env.md: 패치 버전 변경 로그 추가Test Plan
typeof process === 'undefined'확인 후 위젯 마운트 성공 확인