Description
We're using Laravel Vapor and have followed the installation and setup instructions in the README.md to setup the DynamoDB table, API Gateway and updated IAM role as well as include the 4 .env variables to set the broadcast drive, DB table, Gateway API ID and stage.
Having installed both the composer and NPM packages we've then setup our JS with the following:
import Echo from 'laravel-echo';
import {broadcaster} from 'laravel-echo-api-gateway';
window.Echo.join(`stream.${eventSlug}`)
.listen('UpdateStreamTitle', e => {
console.log(e.title);
})
.error((error) => {
console.error(error);
});
Our BrodcastServiceProvider.php
contains
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Broadcast;
use Illuminate\Support\ServiceProvider;
class BroadcastServiceProvider extends ServiceProvider
{
public function boot()
{
Broadcast::routes();
require base_path('routes/channels.php');
}
}
and our routes/channels.php
has
<?php
use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('stream.{eventSlug}', function ($user, $data) {
return ['name' => $user->first_name . ' ' . $user->last_name, 'data' => $data];
});
When viewing the developer console we're seeing a few logged messages and then an Invalid auth signature
error. The console logs read as:
just set socketId to M-C-kdiQrPECH3A=
Sending auth request for channel presence-stream.my-mega-event
Subscribing to channels presence-stream.my-mega-event
Received event error on channel presence-stream.my-mega-event
{message: 'Invalid auth signature'}
Looking at the Network activity I can see the request to /broadcasting/auth
sends the channel_name
and socket_id
and returns with auth
and channel_data
.
Inspecting the WebSocket network activity I see a request to our configured wss://{api-ip}.execute-api.{region}.amazonaws.com/{stage}
Gateway API (with the variables replaced). This returns with the following data:
{
connectionId: "M-C-kdiQrPECH3A="
message: "Internal server error"
requestId: "M-DasGC8LPEFqGA="
}
For what it's worth we're running:
- Laravel 8.81.0
- Laravel Echo 1.11.3
- Laravel Echo API Gateway (NPM Package) 0.1.2
- Laravel Echo API Gateway (Composer Package) 0.3.0
I'm not sure where things are going wrong so any help would be greatly appreciated.
Many thanks.