I tried accessing the pusher api key in my Next.js project like this
process.env.PUSHER_APP_KEY
but received the same error but when I replaced the value with the litral value it worked just fine but due to obvious security reasons this cannot be used like this. First doubt was that I might be making some kind of typo but it wasn't the case, the following helped me so replace the above snippet with the below
`${process.env.PUSHER_APP_KEY}`
This solved my issue I hope helps other facing the same issue. Happy coding.