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

Compatibility issues with Lumen 5.2.8? #5

Open
colinodell opened this issue Aug 10, 2016 · 6 comments
Open

Compatibility issues with Lumen 5.2.8? #5

colinodell opened this issue Aug 10, 2016 · 6 comments

Comments

@colinodell
Copy link
Contributor

colinodell commented Aug 10, 2016

I'm pretty sure I've configured this library correctly, but when I send requests into Lumen I get this exception:

[2016-08-10 22:00:36] lumen.ERROR: exception 'ReflectionException' with message 'Class alexa.router.middleware does not exist' in /srv/www/alexa-project/vendor/illuminate/container/Container.php:734
Stack trace:
#0 /srv/www/alexa-project/vendor/illuminate/container/Container.php(734): ReflectionClass->__construct('alexa.router.mi...')
#1 /srv/www/alexa-project/vendor/illuminate/container/Container.php(629): Illuminate\Container\Container->build('alexa.router.mi...', Array)
#2 /srv/www/alexa-project/vendor/laravel/lumen-framework/src/Application.php(206): Illuminate\Container\Container->make('alexa.router.mi...', Array)
#3 /srv/www/alexa-project/vendor/illuminate/container/Container.php(1174): Laravel\Lumen\Application->make('alexa.router.mi...')
#4 /srv/www/alexa-project/vendor/develpr/alexa-app/src/Provider/AlexaServiceProvider.php(97): Illuminate\Container\Container->offsetGet('alexa.router.mi...')
#5 /srv/www/alexa-project/vendor/illuminate/container/Container.php(731): Develpr\AlexaApp\Provider\AlexaServiceProvider->Develpr\AlexaApp\Provider\{closure}(Object(Laravel\Lumen\Application), Array)
#6 /srv/www/alexa-project/vendor/illuminate/container/Container.php(629): Illuminate\Container\Container->build(Object(Closure), Array)
#7 /srv/www/alexa-project/vendor/laravel/lumen-framework/src/Application.php(206): Illuminate\Container\Container->make('Develpr\\AlexaAp...', Array)
#8 /srv/www/alexa-project/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(362): Laravel\Lumen\Application->make('Develpr\\AlexaAp...')
#9 /srv/www/alexa-project/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(343): Laravel\Lumen\Application->callTerminableMiddleware(Object(Illuminate\Http\Response))
#10 /srv/www/alexa-project/public/index.php(28): Laravel\Lumen\Application->run()
#11 {main}  

From what I can tell, alexa.router.middleware is only defined in the LaravelServiceProvider. In LumenServiceProvider there's a app.middleware defined instead.

I tried changing this app.middleware string to alexa.router.middleware but that led to another exception:

[2016-08-10 22:04:29] lumen.ERROR: exception 'ErrorException' with message 'Argument 1 passed to Develpr\AlexaApp\Http\Middleware\Request::__construct() must be an instance of Illuminate\Contracts\Foundation\Application, instance of Laravel\Lumen\Application given, called in /srv/www/alexa-project/vendor/develpr/alexa-app/src/Provider/AlexaServiceProvider.php on line 97 and defined' in /srv/www/alexa-project/vendor/develpr/alexa-app/src/Http/Middleware/Request.php:44
Stack trace:
#0 /srv/www/alexa-project/vendor/develpr/alexa-app/src/Http/Middleware/Request.php(44): Laravel\Lumen\Application->Laravel\Lumen\Concerns\{closure}(4096, 'Argument 1 pass...', '/srv/www/alexa....', 44, Array)
#1 /srv/www/alexa-project/vendor/develpr/alexa-app/src/Provider/AlexaServiceProvider.php(97): Develpr\AlexaApp\Http\Middleware\Request->__construct(Object(Laravel\Lumen\Application), Object(Develpr\AlexaApp\Http\Routing\AlexaRouter), Object(Develpr\AlexaApp\Request\AlexaRequest), Array)
#2 /srv/www/alexa-project/vendor/illuminate/container/Container.php(731): Develpr\AlexaApp\Provider\AlexaServiceProvider->Develpr\AlexaApp\Provider\{closure}(Object(Laravel\Lumen\Application), Array)
#3 /srv/www/alexa-project/vendor/illuminate/container/Container.php(629): Illuminate\Container\Container->build(Object(Closure), Array)
#4 /srv/www/alexa-project/vendor/laravel/lumen-framework/src/Application.php(206): Illuminate\Container\Container->make('Develpr\\AlexaAp...', Array)
#5 /srv/www/alexa-project/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(362): Laravel\Lumen\Application->make('Develpr\\AlexaAp...')
#6 /srv/www/alexa-project/vendor/laravel/lumen-framework/src/Concerns/RoutesRequests.php(343): Laravel\Lumen\Application->callTerminableMiddleware(Object(Illuminate\Http\Response))
#7 /srv/www/alexa-project/public/index.php(28): Laravel\Lumen\Application->run()
#8 {main}

Any thoughts or guidance would be really appreciated - this is my first time working on a Laravel/Lumen application, so I'm a bit over my head.

Edit: Removed the first exception, I think that was the result of me messing around with things.

@colinodell
Copy link
Contributor Author

Downgrading to Lumen 5.1.7 and develpr/alexa-app 0.2.2 seems to work (but obviously isn't ideal). Versions 0.2.3+ seem broken, likely due to these changes: 0.2.2...0.2.3

@colinodell
Copy link
Contributor Author

Lumen 5.1.7 and develpr/alexa-app 0.2.7 play nicely if https://github.com/develpr/alexa-app/blob/0.2.7/src/Provider/LumenServiceProvider.php#L18 is changed accordingly:

-       $this->app->instance('app.middleware', $this->gatherAppMiddleware($reflection));
+       $this->app->instance('alexa.router.middleware', $this->gatherAppMiddleware($reflection));

@colinodell
Copy link
Contributor Author

colinodell commented Aug 10, 2016

So yeah, I'm not a Laravel/Lumen expert by any means, but it almost seems like this library simply isn't compatible with Lumen 5.2.

Would you have any objections to making this library compatible with 5.2 (and dropping support for 5.1)? I don't mind doing the work (or at least trying to), though I must admit I'll only be testing against Lumen.

@develpr
Copy link
Collaborator

develpr commented Aug 11, 2016

Hey @colinodell , thank you so much for taking the time to take a look at this! A few comments:

  1. I have absolutely not problem with updating to make things compatible with Lumen 5.2
  2. If you are willing to take a stab at it please feel free!
  3. For what it's worth, I'm currently working on a Laravel project with the current version and things are working as they should be.. My only point being if you are not 100% married to Lumen, you should be able to use this with Laravel and it should "just work"

To be honest there hasn't been all that much interest in this and as my own projects have mainly been with Laravel lately I haven't given as much love to Lumen.

I will also try to take a look at Lumen support for 5.2/3 myself, but I'm pretty busy with work lately so it could be a bit. Again though, if you want to take a look that would be awesome!

@colinodell
Copy link
Contributor Author

I've ended up switching to Laravel and it does indeed work perfectly.

Not sure if you want to keep this open (should others be interested in fixing this).

@develpr
Copy link
Collaborator

develpr commented Aug 17, 2016

I think it's worth leaving open for now. I appreciate your time. I should (and will) reflect in the docs that there is a known issue with 5.2.8 (at least) and point people here for now until it's either resolved by somebody who has a vested interest, or until I am working with Lumen again myself! Thanks again for your time with this @colinodell !

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

2 participants