cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP 500 error in frontend page

HTTP 500 error in frontend page

If I open frontend page or catalog menu in backend admin page, HTTP 500 error is occurred.

 

/var/log/nginx/error.log :

[error] 9326#9326: *4135 FastCGI sent in stderr: "PHP message: PHP     Fatal error:  Uncaught Error: Call to a member function isSwatchAttribute() on null in /home/(...)/vendor/magento/module-swatches/Helper/Data.php
[error] 9326#9326: *4220 access forbidden by rule

 

How can I fix this?

 

4 REPLIES 4

Re: HTTP 500 error in frontend page

Hi @NDelt,

Can you please mentioned on which line no error display and your Magento 2.x version?

Re: HTTP 500 error in frontend page

I hope you have set permission for your site like below,

sudo find var pub/static pub/media -type f -exec chmod g+w {} \; 
sudo find var pub/static pub/media -type d -exec chmod g+ws {} \;
sudo find ./pub/media -type d -exec chmod 777 {} \;
sudo find ./pub/static -type d -exec chmod 777 {} \;
If Issue Solved, Click Kudos/Accept As solutions. Get Magento insight from
Magento 2 Blogs/Tutorial

Re: HTTP 500 error in frontend page

I'm using Magento 2.2.5. And this error has occurred after installing templates.

Re: HTTP 500 error in frontend page

Hello,

please check below file for same

vendor/magento/module-swatches/Helper/Data.php
Fixed it with a core hack.

Above:

$swatchAttributes = $this->swatchAttributesProvider->provide($product);

Put this:

if (!isset($this->swatchAttributesProvider)) { $this->swatchAttributesProvider = ObjectManager::getInstance()->get(SwatchAttributesProvider::class); }

 

More info :

https://github.com/magento/magento2/issues/10388

 

Hope it will help you.

 

If works then mark as solution.

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer