Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Jibon's avatar
Level 2

Laravel Reverb in Production getting error "Uncaught You must pass your app key when you instantiate Pusher."

I am using Laravel 11 with Vue js.

My project locally runs fine. but when the project uploads on shared hosting getting this error "Uncaught You must pass your app key when you instantiate Pusher."

How can I solve this error?

1 like
13 replies
Snapey's avatar

are you trying to use env values directly?

Jibon's avatar
Level 2

@Snapey

no, I am use import.meta.env `import Echo from 'laravel-echo';

import Pusher from 'pusher-js'; window.Pusher = Pusher;

window.Echo = new Echo({ broadcaster: 'reverb', key: import.meta.env.VITE_REVERB_APP_KEY, wsHost: import.meta.env.VITE_REVERB_HOST, wsPort: import.meta.env.VITE_REVERB_PORT ?? 80, wssPort: import.meta.env.VITE_REVERB_PORT ?? 443, forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https', enabledTransports: ['ws', 'wss'], }); `

martinbean's avatar

@jibon In that case, it sounds like you’ve not set your Pusher keys on the server.

Snapey's avatar

so did you forget that you need to run a reverb server?

abdulkhan's avatar

php artisan reverb:restart

will fixed the pusher key error for reverb.

1 like
tarikmanoar's avatar

@Jibon I'm facing same issue would you solve this issue or figure out how to run reverb on cpanel?

seewhy's avatar

@abdulkhan Same issue couldnt get either pusher or reverb to work on Namecheaps stellar plan

agmc's avatar

I had the same issue: the application would run just fine locally but gave that error on the production server. For production we have a ci/cd script that does stuff including copying files and at some point it runs npm run build.

My issue was that the .env file was not copied yet at the time npm run build was run. So the solution was to copy .env first, then npm run build.

Please or to participate in this conversation.