카테고리 없음
netlify .env 키 관련 추가하기
지에고
2025. 2. 26. 11:06
오픈 api key 를 사용해서 웹사이트를 개발했을때
env 는 깃허브에 추가되지않아 아래와 같은 에러가 발생한다.
Error: The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }).
at new dg (C:\bitcoin_ziego\.next\server\app\api\trading-advice\route.js:5:25567)
api 를 사용할수있는 key 가 셋팅이 안된 것인데 이럴 경우 netlify 사이트에서 직접 지정을 하면된다.
아래와 같이 site configuration 을 클릭하고
아래와 같이 add a single cariable 로 추가해두면 됩니다.