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

Unresolvable dependency resolving [Parameter #0 [ $auth_key ]] #16712

Closed
progamer opened this issue Dec 8, 2016 · 2 comments
Closed

Unresolvable dependency resolving [Parameter #0 [ $auth_key ]] #16712

progamer opened this issue Dec 8, 2016 · 2 comments

Comments

@progamer
Copy link

progamer commented Dec 8, 2016

  • Laravel Version: 5.3.*
  • PHP Version:7.0.8
  • Database Driver & Version:
    DB_CONNECTION=mysql

Description:

Unresolvable dependency resolving [Parameter #0 [ $auth_key ]] in class Pusher in /vendor/laravel/framework/src/Illuminate/Container/Container.php:850

Steps To Reproduce:

My env file
BROADCAST_DRIVER=pusher
PUSHER_APP_ID=xxxxxx
PUSHER_KEY=xxxxxxxxxxxxxx
PUSHER_SECRET=xxxxxxxxxxxxxx

I create a notification and trigger it

full error trace

[2016-12-07 20:29:28] local.ERROR: Illuminate\Contracts\Container\BindingResolutionException: Unresolvable dependency resolving [Parameter #0 [ $auth_key ]] in class Pusher in vendor/laravel/framework/src/Illuminate/Container/Container.php:850
Stack trace:
#0 vendor/laravel/framework/src/Illuminate/Container/Container.php(817): Illuminate\Container\Container->resolveNonClass(Object(ReflectionParameter))
#1 vendor/laravel/framework/src/Illuminate/Container/Container.php(788): Illuminate\Container\Container->getDependencies(Array, Array)
#2 vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build('pusher', Array)
#3 vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make('pusher', Array)
#4 vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php(233): Illuminate\Foundation\Application->make('pusher')
#5 vendor/laravel/framework/src/Illuminate/Support/Manager.php(63): Illuminate\Notifications\ChannelManager->createDriver('pusher')
#6 vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php(79): Illuminate\Support\Manager->driver('pusher')
#7 vendor/laravel/framework/src/Illuminate/Notifications/ChannelManager.php(43): Illuminate\Notifications\ChannelManager->sendNow(Object(Illuminate\Database\Eloquent\Collection), Object(App\Notifications\CommentOnYourPost))
#8 vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(237): Illuminate\Notifications\ChannelManager->send(Object(Illuminate\Database\Eloquent\Collection), Object(App\Notifications\CommentOnYourPost))
#9 app/Services/NotificationService.php(31): Illuminate\Support\Facades\Facade::__callStatic('send', Array)
#10 app/Observers/CommentObserver.php(37): App\Services\NotificationService->notifyNewCommentAdded(Object(App\Comment))
#11 [internal function]: App\Observers\CommentObserver->updating(Object(App\Comment))
#12 vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(348): call_user_func_array(Array, Array)
#13 [internal function]: Illuminate\Events\Dispatcher->Illuminate\Events{closure}(Object(App\Comment))
#14 vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(221): call_user_func_array(Object(Closure), Array)
#15 vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(164): Illuminate\Events\Dispatcher->fire('eloquent.updati...', Array, true)
#16 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1664): Illuminate\Events\Dispatcher->until('eloquent.updati...', Object(App\Comment))
#17 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1525): Illuminate\Database\Eloquent\Model->fireModelEvent('eloquent.updati...')
#18 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1464): Illuminate\Database\Eloquent\Model->performUpdate(Object(Illuminate\Database\Eloquent\Builder), Array)
#19 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php(225): Illuminate\Database\Eloquent\Model->save()
#20 vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php(95): Illuminate\Database\Eloquent\Relations\HasOneOrMany->save(Object(App\Comment))
#21 app/Http/Controllers/Front/CommentsController.php(60): Illuminate\Database\Eloquent\Relations\MorphOneOrMany->save(Object(App\Comment))
#22 [internal function]: App\Http\Controllers\Front\CommentsController->store(Object(App\Http\Requests\StoreComment), Object(App\Post))
#23 vendor/laravel/framework/src/Illuminate/Routing/Controller.php(55): call_user_func_array(Array, Array)
#24 vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(44): Illuminate\Routing\Controller->callAction('store', Array)
#25 vendor/laravel/framework/src/Illuminate/Routing/Route.php(189): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Http\Controllers\Front\CommentsController), 'store')
#26 vendor/laravel/framework/src/Illuminate/Routing/Route.php(144): Illuminate\Routing\Route->runController()
#27 vendor/laravel/framework/src/Illuminate/Routing/Router.php(642): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#28 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Routing\Router->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#29 vendor/xinax/laravel-gettext/src/Xinax/LaravelGettext/Middleware/GettextMiddleware.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#30 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Xinax\LaravelGettext\Middleware\GettextMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))
#31 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#32 vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#33 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))
#34 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#35 vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#36 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
#37 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#38 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(65): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#39 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#40 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#41 vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#42 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#43 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#44 vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(64): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#45 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#46 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#47 vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#48 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#49 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#50 vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#51 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#52 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#53 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#54 vendor/laravel/framework/src/Illuminate/Routing/Router.php(644): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#55 vendor/laravel/framework/src/Illuminate/Routing/Router.php(618): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#56 vendor/laravel/framework/src/Illuminate/Routing/Router.php(596): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#57 vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(268): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#58 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http{closure}(Object(Illuminate\Http\Request))
#59 vendor/barryvdh/laravel-debugbar/src/Middleware/Debugbar.php(51): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#60 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Barryvdh\Debugbar\Middleware\Debugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#61 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#62 vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#63 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(137): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#64 vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(Illuminate\Http\Request))
#65 vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\Routing\Pipeline->Illuminate\Routing{closure}(Object(Illuminate\Http\Request))
#66 vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(150): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#67 vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(117): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#68 public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
#69 {main}

@dwightwatson
Copy link
Contributor

What code are you using that causes this error?

Have you upgraded your version from Laravel from a version earlier than 5.3? Can you confirm you have Illuminate\Broadcasting\BroadcastServiceProvider::class in your providers array?

@progamer
Copy link
Author

progamer commented Dec 9, 2016

@dwightwatson dwightwatson yes i have that service provider in my providers and yes i upgraded from 5.2 to 5.3

the code case this issue

Notification::send($postSubscribers, new CommentOnPostYouSubscribeOn($comment));
`<?php

namespace App\Notifications;

use App\Comment;
use App\Transformers\CommentTransformer;
use App\Transformers\PostTransformer;
use App\Transformers\UserTransformer;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class CommentOnPostYouSubscribeOn extends Notification implements ShouldQueue
{
use Queueable;

protected $comment;
protected $post;

/**
 * Create a new notification instance.
 *
 * @param Comment $comment
 */
public function __construct(Comment $comment)
{
    $this->comment = $comment;
    $this->post = $comment->commentable;
}

/**
 * Get the notification's delivery channels.
 *
 * @param  mixed $notifiable
 * @return array
 */
public function via($notifiable)
{
    return ['database'];
}

/**
 * Get the mail representation of the notification.
 *
 * @param  mixed $notifiable
 * @return \Illuminate\Notifications\Messages\MailMessage
 */
public function toMail($notifiable)
{
    return (new MailMessage)
        ->line('New Comment added to post you watch.')
        ->action('View', 'https://laravel.com')
        ->line('Thank you for using our application!');
}

/**
 * Get the array representation of the notification.
 *
 * @param  mixed $notifiable
 * @return array
 */
public function toArray($notifiable)
{
    return [
        'comment' => $this->comment,
        'post' => $this->post,
        'user' =>$this->comment->user,
        'description' => __('%s commented on post you watch %s ', $this->comment->user->name, substr($this->post->body, 0, 50))

    ];
}

}
`

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

3 participants