Consent to the use of Personal Data and Cookies

This website needs your consent to use cookies in order to customize ads and content.

If you give us your consent, data may be shared with Google.

Cannot read properties of undefined (reading 'data')

This error is usually nothing to worry about. It tends to happen when losing internet connectivity.

22 views

Edited: 2023-01-25 09:36

Cannot read properties of undefined (reading 'data')

This is a really old and nasty error notification in Shopware, and it usually happens when losing internet connectivity. It is nothing to worry about, but the notification is annoying; such errors are best placed in a log file, or perhaps in the browser console – it's not relevant to users.

It happens because Shopware is constantly sending XHR requests in the background, and when these HTTP requests are then unable to reach the server, it will result in Cannot read properties of undefined errors.

I hope Shopware is going to eventually fix it, but until then, you can apply a temporary fix so the notification will not bother your users.

A temporary fix

E.g. In line 33 of the admin-notification-worker.js file:

/var/www/vendor/shopware/administration/Resources/app/administration/src/core/worker/admin-notification-worker.js

You can simply add a check for "Cannot read properties of undefined":

if (false == error.message.includes("Cannot read properties of undefined")) {this.createNotification('error', error.message);}

This fix should only be temporary, and it will automatically be overwritten when Shopware is updated, and by then, hopefully, Shopware will have removed such "meaningless" notifications from the users sight :-)

And specifically it is the loadNotifications method in the file you need to modify.

Be careful when editing system files!

System files should, of course, rarely, if ever, be edited directly. When you decide to do so, you should keep in mind that your changes will be overwritten when updating the system. Sometimes you want this to happen, but other times you don't.

It's usually best if you can add modifications you want to keep either in your shop's theme or in a custom plugin.

Tell us what you think:

  1. Undefined array key password doing installation of Shopware using the web installer.
  2. How SEO URLs work in Shopware, and how to customize them.
  3. How to disable certain Exception error messages in Shopware, so that redundant messages do not show up in the log file.
  4. Running messenger:consume workers with a time limit can be useful, but you should also not set it too low.

More in: Shopware