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

Cannot send a message with Laravel 4.2 #2

Open
ipol2n opened this issue Jun 30, 2016 · 5 comments
Open

Cannot send a message with Laravel 4.2 #2

ipol2n opened this issue Jun 30, 2016 · 5 comments

Comments

@ipol2n
Copy link

ipol2n commented Jun 30, 2016

Hi,

When I tried to send a message with Laravel 4.2, I got this error "parse_url() expects parameter 1 to be string, array given".

Stack trace:

Stack trace:

0 [internal function]: Illuminate\Exception\Handler->handleError(2, 'parse_url() exp...', '/Users/ipol2n/h...', 51, Array)

1 /Users/ipol2n/html/warroom-cbc/vendor/guzzlehttp/psr7/src/Uri.php(51): parse_url(Array)

2 /Users/ipol2n/html/warroom-cbc/vendor/guzzlehttp/guzzle/src/Client.php(142): GuzzleHttp\Psr7\Uri->__construct(Array)

3 /Users/ipol2n/html/warroom-cbc/vendor/guzzlehttp/guzzle/src/Client.php(115): GuzzleHttp\Client->buildUri(Array, Array)

4 /Users/ipol2n/html/warroom-cbc/vendor/guzzlehttp/guzzle/src/Client.php(129): GuzzleHttp\Client->requestAsync('post', Array, Array)

5 /Users/ipol2n/html/warroom-cbc/vendor/guzzlehttp/guzzle/src/Client.php(87): GuzzleHttp\Client->request('post', Array, Array)

6 /Users/ipol2n/html/warroom-cbc/vendor/maknz/slack/src/Client.php(358): GuzzleHttp\Client->__call('post', Array)

7 /Users/ipol2n/html/warroom-cbc/vendor/maknz/slack/src/Client.php(358): GuzzleHttp\Client->post(Array, Array)

8 /Users/ipol2n/html/warroom-cbc/vendor/maknz/slack/src/Message.php(410): Maknz\Slack\Client->sendMessage(Object(Maknz\Slack\Message))

9 [internal function]: Maknz\Slack\Message->send('test')

10 /Users/ipol2n/html/warroom-cbc/vendor/maknz/slack/src/Client.php(124): call_user_func_array(Array, Array)

11 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(208): Maknz\Slack\Client->__call('send', Array)

12 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(208): Maknz\Slack\Client->send('test')

13 /Users/ipol2n/html/warroom-cbc/app/routes.php(210): Illuminate\Support\Facades\Facade::__callStatic('send', Array)

14 /Users/ipol2n/html/warroom-cbc/app/routes.php(210): Maknz\Slack\Laravel\Facade::send('test')

15 [internal function]: {closure}()

16 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Routing/Route.php(109): call_user_func_array(Object(Closure), Array)

17 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1033): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))

18 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Routing/Router.php(1001): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))

19 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(775): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))

20 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))

21 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Session/Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)

22 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Cookie/Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)

23 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Cookie/Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)

24 /Users/ipol2n/html/warroom-cbc/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)

25 /Users/ipol2n/html/warroom-cbc/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))

26 /Users/ipol2n/html/warroom-cbc/public/index.php(49): Illuminate\Foundation\Application->run()

27 {main} [] []

I tried to debug and found that some config of this package are missing.
I dump $app['config'] and found only these config.

  'slack::allow_markdown' => 
    array (size=0)
      empty
  'slack::markdown_in_attachments' => 
    array (size=0)
      empty
  'slack::unfurl_media' => 
    array (size=0)
      empty

Could you please help?

Thank you

@maknz
Copy link
Owner

maknz commented Jun 30, 2016

Could you try this for me: uninstall this package, and just composer require maknz/slack, and follow the instructions at https://github.com/maknz/slack/tree/1.7.0 to set up Laravel.

If that works, then we can debug further what the problem might be here. We recently split off the Laravel integration from the main package to here.

@shinomontaz
Copy link

Hi, maknz!
I've tried your instructions for laravel 4.2 with no result.
But I found that changing all "get('slack:..." to "get('slack-laravel:" in slack-laravel/src/ServiceProviderLaravel4.php for method register do the trick.

Maybe something with config publication for laravel 4 is wrong. Or just was a mistake in register method.

@maknz
Copy link
Owner

maknz commented Jul 22, 2016

Yeah, that's very likely to be an oversight on my part when I moved the Laravel integration out. When I get a chance I'll get this fixed.

In the meanwhile, if you just require maknz/slack 1.7 directly (https://github.com/maknz/slack/tree/1.7.0), you can use the Laravel integration there. 1.7 is still the current stable release.

@beauraines
Copy link

I ran into this same issue, rolling over to maknz/slack:^1.7 worked, with these exceptions...

The provider and alias are slightly different than in the slack-laravel documentation. I have another app that has been using the maknz/slack package for a while, so I was able to steal its setup.

provider
'Maknz\Slack\SlackServiceProvider',

alias
'Slack' => 'Maknz\Slack\Facades\Slack',

@shinomontaz glad to see I'm not alone in L4.2 usage!

@beauraines
Copy link

Oh, drat. I didn't read this well enough to see that there was a fix...

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

4 participants