xxxxxxxxxx
BRUH this took me so long to solve
# Do this in your terminal:
npm cache clean –force
# and also put this at the top of your file
# of course replacing with the name of your env
require('dotenv').config({ path: '.env.local' });
# one of those fixed it for me
# also to debug what your process.env looks like, you can console.log it
# I didn't realize you could do that