1

I am trying to deploy Sylius to Heroku. I have had many attempts but all have been unsuccessful.

I am following this guide: https://dev.to/aaahmedaa/deploy-sylius-to-heroku-55p1

This is the repo I am trying to deploy: https://github.com/ivantxo/creativedss2

The Heroku activity log seems fine and the app is deployed.

But when I visit the app URL I see this: enter image description here

The logs show me this:

2023-08-18T20:51:38.659916+00:00 heroku[router]: at=info method=GET path="/en_US/" host=creativedss-6e8e6463e6bc.herokuapp.com request_id=784e6ab0-8e79-4ac2-8dc3-7dbae6506bd6 fwd="110.174.122.237" dyno=web.1 connect=0ms service=23ms status=500 bytes=1204 protocol=https
2023-08-18T20:51:38.661457+00:00 app[web.1]: 10.1.43.231 - - [18/Aug/2023:20:51:38 +0000] "GET /en_US/ HTTP/1.1" 500 1027 "https://dashboard.heroku.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

My Procfile has: web: heroku-php-nginx -C nginx_app.conf public/

and my nginx_app.conf has:

location / {
    # try to serve file directly, fallback to rewrite
    try_files $uri @rewriteapp;
}

location @rewriteapp {
    # rewrite all to index.php
    rewrite ^(.*)$ /index.php/$1 last;
}

location ~ ^/index\.php(/|$) {
    try_files @heroku-fcgi @heroku-fcgi;
    # ensure that /index.php isn't accessible directly, but only through a rewrite
internal;
}

Any idea please? Any help is appreciated.

Thanks

ivantxo
  • 719
  • 5
  • 18
  • 36
  • 1
    For 500 in PHP context you also need to look into the PHP error log, Nginx error log only tells you that a 500 happened and not why (in this case). Therefore check the PHP error log and add the related parts from it to your question. It then should become visible if it's solveable with the Nginx configuration, the Heroku conifguration or the PHP configuration (including all the source code that did throw/error) – hakre Aug 19 '23 at 01:24
  • 1
    @hakre thanks so much!!! I solve my issues. Bounty is yours. The problem was in my package.json instead of encore production I was doing yarn encore env. But was your answer that led me to find the solution. Thank you. – ivantxo Aug 19 '23 at 07:25
  • Thanks for the feedback, that was great to read! And you should probably write an answer as well where you describe the real answer and accept that one because it is the corresponding one with your question. The accepted answer should be independent to the bounty from what I know, so this would be to have the correct documentation because I think this will be more helpful for you and others in the future. And happy again to read you solved it that quickly then. – hakre Aug 19 '23 at 22:29

1 Answers1

1

For HTTP status 500 in PHP context you also need to look into the PHP error log, Nginx error log only tells you that a 500 happened and not why (in this case).

Therefore check the PHP error log and add the related parts from it to your question.

It then should become visible if it's solvable with the Nginx configuration, the Heroku configuration or the PHP configuration (including all the source code that did throw/error).

hakre
  • 193,403
  • 52
  • 435
  • 836