Mohmmad Fayez
Mohmmad Fayez

Reputation: 11

have isuue with using Pusher with laravel 5.6

I'm trying to use pusher with laravel 5.6 and vue.js but i'm always getting error message

uncaught exception: You must pass your app key when you instantiate Pusher.

i already created free pusher account and i posted my appkey at .env file

PUSHER_APP_ID=<REDACTED> PUSHER_APP_KEY=<REDACTED>
PUSHER_APP_SECRET=<REDACTED> PUSHER_APP_CLUSTER=eu

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

and at bootstrab.js i already created new echo instance and posted my pusher settings like this

import Echo from 'laravel-echo' window.Pusher = require('pusher-js');

window.Echo = new Echo({ broadcaster: 'pusher', key:process.env.MIX_PUSHER_APP_KEY, cluster:process.env.MIX_PUSHER_APP_CLUSTER, encrypted: true });

pusher.log=function(message) { window.console.log(message) }

can some body help to solve this issue please...

Upvotes: 1

Views: 5565

Answers (2)

Olie Cape
Olie Cape

Reputation: 1056

This may be a problem in cache.

you can try

php artisan optimize:clear

then

npm run dev

This solves problems about cache most of the time.

Note: Do not use config:cache after an optimize:clear because that would cache your current configuration. What we need in this situation is to clear everything in config cache so that a new config can be setup during build.

Upvotes: 1

doydoy
doydoy

Reputation: 4091

You should specify each variable on its own line.

I have also updated your question to remove the credentials. You should creating a new app in the Pusher dashboard and remove the existing app to prevent unsolicited connections. Once the new app is created you can use the new credentials as normal.

Upvotes: 0

Related Questions