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

Slim Skeleton shows 500 error right after setup #119

Closed
gopumon opened this issue Aug 12, 2019 · 9 comments
Closed

Slim Skeleton shows 500 error right after setup #119

gopumon opened this issue Aug 12, 2019 · 9 comments

Comments

@gopumon
Copy link

gopumon commented Aug 12, 2019

Right after composer create-project slim/slim-skeleton myslimsite, I ran composer start and went to localhost:8080/users/ which returned a json object as below.

{
    "statusCode": 404,
    "error": {
        "type": "RESOURCE_NOT_FOUND",
        "description": "Not found."
    }
}{
    "statusCode": 500,
    "error": {
        "type": "SERVER_ERROR",
        "description": "ERROR: ob_clean(): failed to delete buffer. No buffer to delete on line 28 in file \/Volumes\/WD Mac\/work\/test\/slim-project\/myslimsite\/src\/Application\/ResponseEmitter\/ResponseEmitter.php."
    }
}

Any help on this much appreciated.

@gopumon
Copy link
Author

gopumon commented Aug 12, 2019

Update:

I just changed the line 28 of ResponseEmitter.php to if(ob_get_contents()) ob_clean(); which took off the 500 Server Error, but still have problem with route /users/ (Trailing Slash) but no 404 with route /users.

I installed Trailing Slash middleware as mentioned in the documentation by

composer require middlewares/trailing-slash

and changing /app/middleware.php to

<?php
declare(strict_types=1);

use App\Application\Middleware\SessionMiddleware;
use Middlewares\TrailingSlash;
use Slim\App;

return function (App $app) {
    $app->add(new TrailingSlash(true));
    $app->add(SessionMiddleware::class);
};

Still no luck with trailing slashes, shows 404 for routes with /.

@erwinsetiawan
Copy link

Same here I got 404 after installation. Any help?

@erwinsetiawan
Copy link

Oh thats my Nginx config @gopumon check your webserver config. It might be wrong with your web server configuration

@timogoosen
Copy link

Come on to the Slim slack and maybe someone can help you:
slimphp.slack.com

@gopumon
Copy link
Author

gopumon commented Aug 12, 2019

Come on to the Slim slack and maybe someone can help you:
slimphp.slack.com

Thanks @timogoosen , but I don't have an invitation on that Slack workspace.

The issue I face is the middleware TrailingSlash is not modifying the routes. The uri without trailing slashes works. The middleware have no effect. Initiates middleware on routes without trailing slashes.

I got rid of the 500 error with a simple if statement as mentioned above, don't know why that ob_clean() is called there and my fix is good or not.

@akrabat
Copy link
Member

akrabat commented Aug 12, 2019

This question is better asked on our Slack and/or our discourse forum.

@l0gicgate
Copy link
Member

I just changed the line 28 of ResponseEmitter.php to if(ob_get_contents()) ob_clean(); which took off the 500 Server Error

This has been fixed via #117

I haven't tagged a new release yet. I will later this week.

@l0gicgate
Copy link
Member

Just released 4.0.1. I'm closing this as resolved. Please join our Slack group for further help.

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