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

Resolving of api routes makes route 404 #1708

Closed
luceos opened this issue Dec 18, 2018 · 1 comment
Closed

Resolving of api routes makes route 404 #1708

luceos opened this issue Dec 18, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@luceos
Copy link
Member

luceos commented Dec 18, 2018

Bug Report

Current Behavior

When registering an api route on the root extend.php like this:

    (new Extend\Routes('api'))
        ->post('/auth/flagrow', 'auth.flagrow.callback', Controllers\Auth\FlagrowCallbackController::class),

The route is not found. The cause seems to lie in the fact that the routes is bound as singleton in the boot of the provider and being resolved and pushed to the router in the boot. The extenders are however run after the providers are booted, so hooking into them resolving will be too late.

I changed the following in InstalledSite and that resolved the issue I had locally:

        $laravel->boot();

        foreach ($this->extenders as $extension) {
            $extension->extend($laravel);
        }

to

        foreach ($this->extenders as $extension) {
            $extension->extend($laravel);
        }

        $laravel->boot();
@franzliedke
Copy link
Contributor

Yep, that fix is correct. (Although we can discuss whether the local extenders should run first, or the ones from enabled extensions. In the latter case - which I prefer - this would have to change slightly.)

@franzliedke franzliedke added this to the 0.1.0-beta.9 milestone Dec 18, 2018
franzliedke added a commit that referenced this issue Dec 18, 2018
We still need to discuss the priority of local extenders vs. those
from enabled extensions, but let's first fix the actual bug.

Refs #1708.
wzdiyb pushed a commit to wzdiyb/core that referenced this issue Feb 16, 2020
wzdiyb pushed a commit to wzdiyb/core that referenced this issue Feb 16, 2020
We still need to discuss the priority of local extenders vs. those
from enabled extensions, but let's first fix the actual bug.

Refs flarum#1708.
wzdiyb pushed a commit to wzdiyb/core that referenced this issue Feb 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants