2

In .env.local I'm trying this:

BASE_URL=https://image.tmdb.org/t/p/original 
API_KEY=xxxx

The API_KEY works fine, but when I try to use the BASE_URL I get undefined

 <Image
    src={`${process.env.BASE_URL}${poster_path}`}
    height={375}
    width={250}
    alt="movie poster"
    layout="responsive"
/>

Why could this be?

relidon
  • 2,142
  • 4
  • 21
  • 37
  • You have to prefix the environment variable with `NEXT_PUBLIC_` to expose it to the browser. See [Environment variables not working (Next.JS 9.4.4)](https://stackoverflow.com/questions/62386582/environment-variables-not-working-next-js-9-4-4). – juliomalves Aug 12 '22 at 22:50

0 Answers0