Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid auth signature #16

Open
icreatestuff opened this issue Feb 3, 2022 · 7 comments
Open

Invalid auth signature #16

icreatestuff opened this issue Feb 3, 2022 · 7 comments

Comments

@icreatestuff
Copy link

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.

@nandorossetti
Copy link

Have you set the Echo's authEndpoint in your window.Echo params?

@icreatestuff
Copy link
Author

@nandorossetti It's using the default /broadcasting/auth at the moment, should it be set to something else when using this package?

@nandorossetti
Copy link

Specify explicitly the authEndpoint and test by logging the authEndpoint path in case it happens to be failing.

@icreatestuff
Copy link
Author

I was using a Presence Channel and have since simplified things for testing to use a regular Channel. I'm still getting Internal Server Error messages in the websocket responses after a successful connection similar to @nandorossetti issue here .

@jdavidbakr
Copy link
Contributor

I had this happen when connecting from my local machine and my APP_KEY did not match the one deployed.

@Adesin-fr
Copy link
Contributor

Do you still experience this issue ?

@leob
Copy link
Collaborator

leob commented Nov 11, 2024

@Adesin-fr I've never experienced this one myself :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants