Uncaught You must pass your app key when you instantiate Pusher on Nextjs 13
Closed this issue · 3 comments
pegasus4me commented
Hello,
I got this error when i setup a pusher connection on client side
Uncaught You must pass your app key when you instantiate Pusher
my code:
const pusher = new Pusher( process.env.PUSHER_KEY, {
cluster : 'eu'
});
benw-pusher commented
Have you ensured your app key is correctly configures under the PUSHER_KEY environment variable?
pegasus4me commented
Have you ensured your app key is correctly configures under the PUSHER_KEY environment variable?
hi @benw-pusher yes I just checked again I't seems like is correclty configured
PUSHER_APP_ID="1234"
PUSHER_KEY="1234"
PUSHER_SECRET="1234"
PUSHER_CLUSTER="eu"
pegasus4me commented
I found the error, I just forgot that on nextjs the .env variables are only available on the server side by default, so to make them available on the browser I just added NEXT_PUBLIC_ before the PUSHER_KEY key like this NEXT_PUBLIC_PUSHER_KEY