Magento2: Magento2 message manager error

Created on 22 Feb 2016  路  22Comments  路  Source: magento/magento2

In Magento2 login page, if we try to login with wrong credentials, the error message('Invalid login or password.') is not showing on the same page and they will show only on any other page with some other message.
issue

Anybody please help me to solve this issue.
I'm using latest Magento 2.0.2 version.

Fixed in 2.2.x Fixed in 2.3.x Format is not valid Ready for Work bug report

Most helpful comment

I have same issue in magento 2.1.5.

All 22 comments

I have the same problem plus this:
https://github.com/magento/magento2/issues/3572

I have exactly the same problem. Is there any news?

@vipin-eglobeits and @FranRoy , can you share with us some details about your installation environment? such as operating system, running a virtual machine or containers? any special software running on your Magento instance? Thanks!

Sure @sengaigibon, It is a fresh install on a EC2 + MySQL RDS amazon environment with nginx and php7. It is runing the amazon linux S.O. The only peculiarity is that I did a migration (products,categories + customers) using the migration tool. Also It is important to mention that yesterday I noticed that If I activate the caches, the problem is no longer happening... So the issue happens when caches as deactivated. Thanks!

Hi all, this is the known issue and we have the internal ticket MAGETWO-46014 to have this fixed

Is this issue already fixed or in process?

Hi @vipin-eglobeits, the fixe has been delivered to mainline. See commits 541ec806cae729df118b7844f5d105cbf1a6cec6, 55a6e51296afd2c52cfe7f813a4871ae408f1afc, b4d373919489ccb48af10c5ac287ef39e3af384e, eec31f653e3783d0ba86602c8396fd6e2d159546, af2a8325930ae22e2b7ae3f6513c0068217eacd1, d97ebe56200b73e71d97ca527c99108817586a54, 3120b1e89f48ff630e796c6885aecc3e48c070c8 and 66e6ad66c028e99019c110631df4c9015af4a2ca. Thank you for your contribution to Magento 2!

@slavvka not sure if this has been brought up previously, but we applied these patches to a 2.0.7 installation and the Admin notifications (saved product etc) are being shown on the frontend only.

No save message after save product in admin

screen shot 2016-05-25 at 9 49 43 pm

Refresh frontend

screen shot 2016-05-25 at 9 50 00 pm

@slavvka Is this really fixed in 2.1 to 2.1.2 - i cannot see this fixed at all and it is a bug reported several times here in several tickets... in my opinion it is time to fix it now!

I have same issue in magento 2.1.5.

I have the issue in 2.1.5 as well ! Message that comes won't go. I can see that the "mage-messages" cookie is being cleared in messages.js but still the issue persists. Please find a fix for this ASAP.

There is a workaround you can do for the messages go away since the messages are stored in the session and sometimes the messages are not cleared from the session this cause the cookies retrieve the values from the session. Hence we need to clear the session values which stores the messages.

I have created the plugin to delete the session from the message manager for this operation, we need two files with module enabled and it is running.

1.di.xml

<type name="Magento\Framework\Message\Manager">
        <plugin name="remove-messages-fromsession" type="Vendor\ModuleName\Plugin\DeleteMessageFromSession"/>
    </type>

2.Plugin file - we need to use the around type to do this


 public function aroundGetMessages(
        \Magento\Framework\Message\Manager $subject,
        \Closure $proceed,
        $clear = false,
        $group = null
    )
    {
        $messages = $proceed($clear, $group);
        //if the clear option is entered
        if ($clear) {
            //the session clear is entered
            $this->session->getData($group, true);
        }
        return $messages;
    }

`
Since the session member is protected we have inherit this class from
MagentoFrameworkMessageManager

Hope this will help you and it is working for me

@niranjanleanswift can you share full code of that plugin, it doesn't work for me
my magento version is 2.2.1
upload_12_27_2017_at_5_47_41_pm

Still not fixed in 2.2+. Can someone create a forward port?

https://github.com/magento/magento2/search?q=MAGETWO-46014%3A+delayed+error+messages&type=Commits

It would have been better if these 8 commits were squashed into one.

git cherry-pick \
541ec806cae729df118b7844f5d105cbf1a6cec6 \
55a6e51296afd2c52cfe7f813a4871ae408f1afc \
b4d373919489ccb48af10c5ac287ef39e3af384e \
eec31f653e3783d0ba86602c8396fd6e2d159546 \
af2a8325930ae22e2b7ae3f6513c0068217eacd1 \
d97ebe56200b73e71d97ca527c99108817586a54 \
3120b1e89f48ff630e796c6885aecc3e48c070c8 \
66e6ad66c028e99019c110631df4c9015af4a2ca

But this produces many conflicts due to the different code structures.

@magento-engcom-team give me 2.2.2 instance

Hi @sdzhepa. Thank you for your request. I'm working on Magento 2.2.2 instance for you

@magento-engcom-team give me 2.2.3 instance

Hi @sdzhepa. Thank you for your request. I'm working on Magento 2.2.3 instance for you

Hello @vipin-eglobeits , @DanielRuf, @dangnguyenak

We have verified this issue on 2.2.2, 2.2.3, 2.3 by described steps/instructions fron this ticket.

  • Customer login with incorrect password(several attampts)
  • Create Products from Admin
  • With enabled and disabled caches.

And seem this issue has been fixed
This ticket can be closed.
Please, feel free to reopen or create a new one with details and steps if issue still exists or was not fully fixed

Thank you for feedback and collaboration

@sdzhepa did the bot not create the instances or were the comments deleted?

I'm using version 2.4.1 and we still have this problem, I created a plugin in my base module as indicated below and that solved the problem.

Thanks @niranjanleanswift

There is a workaround you can do for the messages go away since the messages are stored in the session and sometimes the messages are not cleared from the session this cause the cookies retrieve the values from the session. Hence we need to clear the session values which stores the messages.

I have created the plugin to delete the session from the message manager for this operation, we need two files with module enabled and it is running.

1.di.xml

<type name="Magento\Framework\Message\Manager">
        <plugin name="remove-messages-fromsession" type="Vendor\ModuleName\Plugin\DeleteMessageFromSession"/>
    </type>

2.Plugin file - we need to use the around type to do this


 public function aroundGetMessages(
        \Magento\Framework\Message\Manager $subject,
        \Closure $proceed,
        $clear = false,
        $group = null
    )
    {
        $messages = $proceed($clear, $group);
        //if the clear option is entered
        if ($clear) {
            //the session clear is entered
            $this->session->getData($group, true);
        }
        return $messages;
    }

`
Since the session member is protected we have inherit this class from
MagentoFrameworkMessageManager

Hope this will help you and it is working for me

Was this page helpful?
0 / 5 - 0 ratings