0
Uncaught PHP Exception Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException: "No route found for "GET http://task-demi.herokuapp.com/api/register": Method Not Allowed (Allow: POST)" at /app/vendor/symfony/http-kernel/EventListener/RouterListener.php line 140

So I have uploaded my Symfony 5 in heroku. It is working well in localhost,no error ,but after hosting in Heroku I get above error. I have used SqlLite

DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"

doctrine_heroku.yaml

doctrine:
    dbal:
        driver: 'pdo_sqlite'
        server_version: '3.15'

How to resolve this?

Demi St
  • 57
  • 1
  • 5
  • I don't think this is the cause of the problem you describe here, but [you can't use SQLite on Heroku](https://stackoverflow.com/q/50421061/354577) unless you're okay frequently losing all your data without notice. – ChrisGPT was on strike Nov 24 '21 at 14:12
  • Actually this is simple project just to show to recruiters for a moment. – Demi St Nov 25 '21 at 03:48

1 Answers1

0

Did you install symfony/apache-pack. It allows you to access any URL on your application without having to include /index.php in the path.

In order to quickly enable rewriting for the Apache web server, you can install the symfony/apache-pack recipe, which places a suitable .htaccess file into your public/ directory:

composer require symfony/apache-pack
git add composer.json composer.lock symfony.lock public/.htaccess
git commit -m "apache-pack"

Source : Heroku

glitchcl
  • 318
  • 2
  • 9
  • Your solution worked but when I try to login, I get username or password is wrong or when I try to register user as username=admin, password=admin, `The server returned a "500 Internal Server Error".` while fetching items route is working wel.. – Demi St Nov 25 '21 at 04:16
  • Sqlite is not supported by Heroku. You should try another like Postgres – glitchcl Nov 26 '21 at 14:06