简体   繁体   中英

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...

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM