Not able to display 404 error in prod environment - symfony

When I try to throw a simple throw $this->NotFoundHttpException('We do not currently have a website configured at this address. Please visit our website for more information or contact our support team');in dev environment, it works fine. But when I do the same in prod environment I get 500 server error.
Any ideas?
Here are screenshots of my dev and prod log files
Note: 500 error only happens when I use www in the url in prod env. On using any other word eg. nike, this is what i get
Here is the dev env result for the normal www.blore.eduflats.com url

According to the symfony documentation in order to return a 404 from your controller you need to do the following:
throw $this->createNotFoundException('The product does not exist');
Whereas, you have
throw $this->NotFoundHttpException
The error you are seeing is telling you that NotFoundHttpException does not exist. To fix your problem simply replace NotFoundHttpException with createNotFoundException

You call Eduflas.. UniversityResolver->NotFoundHttpException();
If you want to trhow exception like this, you should declare it.
Symfony Controller have $this->createNotFoundException('Something Not found');
You can throw 404 like this:
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException
//...
throw new NotFoundHttpException("Not found");
Use this way to be sure that Exception exist and test it.
Anyway clear your production and dev cache to be sure you use "the same code".
Last thing that come to my head - its possible you override error pages and you make something to your error.html.twig or error404.html.twig and you got different pages.
EDIT
When i enter your http://blore.eduflats.com/ i got
"array(29) { ["HTTP_HOST"]=> string(18) "blore.eduflats.com" ["HTTP_USER_AGENT"]=> s..."
Anyway your dev env. got error too so how it can work on prod env...
If you throw NotFoundException in dev you should get symfony debugger page and this error. In porduction this error is catch with ExceptionController and display blank error page (user should not see exceptions, only 500 error)

Related

No RegionEndpoint or ServiceURL configured in SWAGGER

I have been trying to solve this issue since forever.
When I try to debug an endpoint from my swagger it doesn't seem to hit the controller and instead "No RegionEndpoint or ServiceURL configured" error message is being displayed. I checked my aws setting the regionendpoint is set as "us-east-1". it has been configured and I have the access. I dont know why this issue is arising. Can anybody help.
Also, I am able to debug other endpoints it is only this other endpoint that doesnt hit the controller.
The problem was resolved. The .aws/credentials files wasn’t being read.

Uncaught error in Pagespeed Insights on Wordpress installation

Have no clue what ghost-rider is... Error follows.
Lighthouse returned error: generic::internal: Extension result empty.
Lighthouse calling Page.navigate with https://www.redacted.com/blog
Uncaught (in promise) Error: Extension timed out. No call to exit()
before render timeout. at wrs.Extension.onTimeout_
(http://ghost-rider/devtools_script_api.js:5576:13) at
http://ghost-rider/devtools_script_api.js:708:9 at Map.forEach
() at chromium.DevTools.Connection.dispatchMessage
(http://ghost-rider/devtools_script_api.js:707:76) at
chromium.DevTools.Connection.onJsonMessage_
(http://ghost-rider/devtools_script_api.js:689:65) at :1:40
i agree it looks sketchy. i'm getting that same error when running pagespeed on my joomla test site. i grepped 'ghost-rider' on my server and full-text searched my db and can't find that anywhere on the site.
the url doesn't work and the domain ghost-rider is invalid of course. no .com or anything. weird...
running lighthouse on https://www.webpagetest.org/lighthouse gives a timeout after 80 seconds on my site (nothing about ghost-rider). http://gtmetrix.com/ and sites like that seem to work fine and the site loads in about 6-10 secs.
ran an ispp scan and didn't find anything.
nothing else to add... anyone else getting this on pagespeed/lighthouse?

Routing & redirecting with iron-router

How does one do an official redirect to another route from a Template.event call using meteor and Iron-Router. I seem to, at least with the Dev branch run into the same error
`if (this._isRunning) // 174
throw new Error('Already in a page run'); `
As an example, i have a button that on click calls Router.go('/home'); if i run this, i get the 'already in a page run' error. Anyone else routing with the router go method?
Its actually the 'this.redirect('/anotherpath')' that causes the problem. Is there way to stop the current running page run and redirect to another route?
It looks like you're working off of the dev branch. The code you were working with has been rolled back because it wasn't working properly. If you still have the issue let me know, and sorry about that!
The code below will stop the current route controller from running (stop any downstream hooks and the action method from being run) and call Router.go('/anotherpath') which will cause a new route to run.
this.redirect('/anotherpath')

Oops! An Error Occurred The server returned a "500 Internal Server Error" on new actions created

I get the error as soon as I enter one of my actions on the project.
Oops! An Error Occurred The server returned a "500 Internal Server Error". Something is broken
Only on 1 page (Action) it happens. The most recent Action I created. The strange thing is that this happens only on the server. Locally on my windows server the page works normally.
The PHP internal logs on the server returns no errors.
The error occurs even if I remove all the code in the action and even if I clear the cache with 'php symfony cc'. Even if I set the permissions with 'php symfony project:permissions'. Even if I combine all of the previous solutions in different order.
Here is the action code:
public function executeExportPostsToProject(sfWebRequest $request)
{
echo 'why?? Show me please!';
}
On the same module there are about 20 other actions decleared the same way. I'm going crazy.
Tryed to check my server configuration for symfony. No Warnings.
The symfony version is 1.4.5.
Seems that the file name of the View is case sensitive under Linux. On Windows hadn't the same problem. On Linux for some reasons with the new files created on windows the problem occured. I renamed the View from exportPostsToProject.php to ExportPostsToProject.php solved this problem.
add route like this in your routing.yml for this action:
route_name:
url: /route-name-example
param: { module: ModuleName, action: exportPostsToProject }
and make sure to be on DEV environment

Wordpress parse error unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

Mates, two days ago, the webhosting of a site i'm administrating went down.
Now it seems to be back working, but when I try to acces to wp-admin i recieve the following error message:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
expecting T_STRING or T_VARIABLE or T_NUM_STRING in
/home/ohmycut/public_html/wp-settings.php on line 80
These are lines from 75 to 85:
// Include the wpdb class and, if present, a db.php database drop-in.
require_wp_db();
// Set the database table prefix and the format specifiers for database table columns.
$GLOBALS['table_prefix'] = $table_prefix;
wp_set_wpdb_vars();
// Start the WordPress object cache, or an external object cache if the drop-in is present.
wp_start_object_cache();
I, honestly, don't understand why am i getting this error.
Any ideas?
thanks!
Try contacting the web hosting service to see if they can revert it to a state before the service went down.

Resources