Magento 2.3: Top issues faced by developers

Learn some top issues faced by any Magento 2.3 platform developers here in this blog.

We picked out some most wanted 2.3 upgrade questions that developers and users request in Magento communities and matched them with working solutions. Some of these Magento 2.3 issues stand at 1k and more in views on the forums.

Want to build an eCommerce solution that sells with no effort? Click here for free developmental consultation!!!

Magento 2.3: Top issues faced by developers

Magento 2.3 Top issues faced by developers

1. External Request, Invalid Form Key Magento 2.3

Issue:

It is a known Magento 2.3 bug that shows after sending a POST request to http://mywebsite.com/custom-module/controllername. The internal server response is “Invalid Form Key. Kindly reload the page.” in Magento 2.2, both GET and POST requests worked as expected. After the upgrade to Magento 2.3, POST requests now do not call the execute() method of the controller but responds with the 200 OK messages.

Solution: 

Your organizer   should execute two of Csrf Aware Action Interface methods:

use Magento\Framework\App\CsrfAwareActionInterface; use Magento\Framework\App\RequestInterface;  use Magento\Framework\App\Request\InvalidRequestException; class MyController extends \Magento\Framework\App\Action\Action implements CsrfAwareActionInterface { public function createCsrfValidationException(RequestInterface $request):  ?InvalidRequestException { return null; } public function validateForCsrf(RequestInterface $request):  ?bool { return true; } } 

The above mentioned code helps this issue, but the solution is not compatible with Magento versions earlier than 2.3. That means the same custom module will stop working on Magento 2.2.x.

2. Magento 2.3 issue on the local server

Issue: 

There are more errors after an attempt to install Magento 2.3 using the command line. It results in various in a browser console and on both backend and storefront. The admin panel doesn’t work. The PHP version is 7.2.

Solution

This is a general issue Magento has with Windows, which hasn’t been fixed by Magento yet. The thing is, Windows uses “\” as a separator, and the check fails if there are containers that have “/”.

This can be fixed by a replacement in the core file. The following line

Magento\Framework\View\Element\Template\File\Validator

replaces the line of code below in isPathInDirectories function:

$realPath = str_replace(‘\\’, ‘/’, $this->fileDriver->getRealPath($path));

Alternate solution:

There is another quick fix to this problem. It is a small modify in the for each loop:

#/vendor/magento/framework/View/Element/Template/File/Validator.php:139 foreach ($directories as $directory)

{ // Add this line $realDirectory = $this->fileDriver->getRealPath($directory); // and replace  `$directory` with `$realDirectory` if (0 === strpos($realPath, $realDirectory)) { return true; } }

3. Magento 2.3 technical error with the server while uploading files

Issue: 

While uploading the logo image on the backend at Content > Design > Configuration > Header, there is an error that looks like this: “technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later”. Actions like cache cleaning and reindexing don’t help. There are no related clues in the logs either, but the image is really displayed on the server as uploaded.

Solution:

This is a known bug of Magento 2.3. It can be fixed by replacing the code. Navigate to /vendor/magento/module-theme/view/adminhtml/ui_component/design_config_form.xml, to the line number 154 and replace “fileUploader” with “imageUploader” like in here:

  <collapsible>true</collapsible> <label translate="true">HTML Head</label> </settings> <!-- Remove this code -->  <!-- <field name="head_shortcut_icon" formElement="fileUploader">--> <!-- Add this code -->  <field name="head_shortcut_icon" formElement="imageUploader"> <settings> <notice translate="true"> Not all browsers support all these formats!</notice> <label translate="true">Favicon Icon</label>  <collapsible>true</collapsible> <label translate="true">Header</label> </settings> <!-- Remove this code -->  <!-- <field name="header_logo_src" formElement="fileUploader"> --> <!-- Add this code -->  <field name="header_logo_src" formElement="imageUploader"> <settings> <label translate="true"> Logo Image</label> <componentType>imageUploader</componentType>

Magento 2.3: Top issues faced by developers

Last Update: May 5, 2021  

December 16, 2019   858   Nandini Ramachandran    Issues, Magento 2 Tutorial, Magento 2.3    
Total 0 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
Twitter
INSTAGRAM
LinkedIn