본문 바로가기

TroubleShooting13

환경변수가 안 불러와진다? 터미널에서는 값이 잘 출력이 되는데 브라우저에서 값이 필요하다면서 오류가 뜬다. 값을 환경변수 적용 없이 직접 넣어주니까 동작은 하는데, 그렇게 하면 키값이 다 드러나니까, 다른 방법을 찾아봐야 할 것 같다. 인터넷 서칭을 해도 딱히 맞는 해결책을 못 찾고 있다가, 문득 현재 내가 보안을 위해 env 값에다가 NEXT_PUBLIC_ 을 안 붙인 것이 생각났다. 페이지들이 다 서버 컴포넌트였어서 문제가 없었는데, 그러고보니 방명록 게시판은 내가 클라이언트 컴포넌트로 만들었다. 아니나 다를까 클라이언트에서 실행되는 API 호출 함수에서 키값을 못 읽어오고 있는 것이었다. BASE_URL 을 NEXT_PUBLIC_BASE_URL 로, API_KEY 를 NEXT_PUBLIC_API_KEY 로 바꾸니까 정상적으로.. 2024. 1. 19.
[ Next.js ] Error: next-image-unconfigured-host const nextConfig = { images : { remotePatterns : [ { protocol : 'https', hostname : 'prod-files-secure.s3.us-west-2.amazonaws.com', } ] } } https://nextjs.org/docs/messages/next-image-unconfigured-host 2024. 1. 8.
[ style X ] Error:stylex.create should never be called. It should be compiled away. //next.config.js import StylexPlugin from '@stylexjs/nextjs-plugin'; import path from "path"; const nextConfig = { experimental: { forceSwcTransforms: true, }, async rewrites (){ return [ { source:'/home', destination:'/' } ] } } const __dirname = path.resolve(); export default StylexPlugin({ filename: 'stylex-bundle.css', rootDir: __dirname, useCSSLayers: true, })(nextConfig); //package.json { .. 2024. 1. 4.
[ Emotion ] props 넘겨줄 때 타입 에러 Type '{ children: Element[]; isMobile: boolean; }' is not assignable to type 'IntrinsicAttributes & { theme?: Theme | undefined; as?: ElementType | undefined; } & ClassAttributes & HTMLAttributes'. // styles.ts export const AboutProfileContainer = styled.div` display: flex; flex-direction: ${props => (props.isMobile ? 'column-reverse' : 'row')}; ` // styles.ts export const AboutProfileContainer .. 2023. 12. 16.
Hydration 보호되어 있는 글 입니다. 2023. 10. 26.
Error: 를 어떻게 [ERROR] 로? class MyError extends Error { constructor( ...params) { super(...params); this.message = [...params]; this.name = '[ERROR]'; } } 참조 https://helloworldjavascript.net/pages/290-exception.html 2023. 10. 22.