I'll preface this by saying my understanding of apps in pusher is that they're like environments, and the keys/secrets separate the environments, so there shouldn't be a case where things cross over.
I feel like I understand the meaning of this error, and I know this has been asked a lot, but I'm seeing something that I feel is entirely different. I'm getting the error Invalid key in subscription auth data: my-staging-environment-app-key
when I trigger a notification from my Laravel app deployed on AWS.
The issue is that I'm triggering the notification from my staging environment, but in the error log in pusher it shows the error as occurring on my development app. I can also submit notifications on my local environment and it works fine. But none come through on my staging environment, and the errors show in the logs on the dev app in pusher (hopefully that makes sense).
I've double, triple, and quadruple checked that my app key and secret are the correct ones for the environment.
On my test environment I've run:
composer dump-autoload
php artisan optimize:clear
I've also restarted the queue worker.
Additionally, I can SSH into my staging environment and run this:
php artisan tinker
config('broadcasting')
It returns the right key and secret for the environment. Running that locally also returns the right key and secret for that environment.
I'm really stumped. Here's some code that will be in no way helpful since I can't give you my keys:
in my broadcasting.php
config file:
'pusher' => [
'driver' => 'pusher',
'key' => env('PUSHER_APP_KEY'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'useTLS' => true,
'encrypted' => true,
],
],
in my .env
file:
PUSHER_APP_ID=my-app-id
PUSHER_APP_KEY=my-app-key-for-this-environment
PUSHER_APP_SECRET=my-app-secret-for-this-environment
PUSHER_APP_CLUSTER=us2
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
in my bootstrap.js file:
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
});
What am I missing??? I've done everything short of rebooting the entire server. I'm using Laravel Forge. Any ideas on places I can check, or commands I can run that might make things work correctly? Or why this would even be happening in the first place? Is there some kind of configuration I'm missing?
This is my attempt to clarify the above as I realize it's probably not super clear:
I Trigger a notification from the staging environment of my web application, and it comes across in the staging app in pusher (seemingly correct):
Simultaneously, this error shows in the development app in pusher, but references the key from my staging app:
Additionally, despite the API message showing up in the pusher console in the correct environment, no notification is ever received in the test environment of my application. Is there any kind of port that needs to be opened up for pusher?