coreshop / CoreShop

CoreShop - Pimcore enhanced eCommerce
http://www.coreshop.org
Other
275 stars 157 forks source link

Bug: Cannot read properties of undefined (reading 'menu') #2226

Closed ITspirit closed 1 year ago

ITspirit commented 1 year ago

On Pimcore 10.6 and use of w-vision/datadefinition (which includes Coreshop) i get this error:

Cannot read properties of undefined (reading 'menu')

In this part of code:

document.addEventListener(coreshop.events.menu.open, (e) => {
            var item = e.detail.item;
            var type = e.detail.type;

            if (item.attributes.resource) {
                coreshop.global.resource.open(item.attributes.resource, item.attributes.function);
            }
        });

Console Output:

script-proxy?storageFile=minified_javascript_core_261ec13a5a54a55d1e07f85446be1991.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:101190 TypeError: Cannot read properties of undefined (reading 'menu')
    at klass.initialize (script-proxy?storageFile=minified_javascript_core_2e45501b67c83d597d00e4a928b17891.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:12533:51)
    at new klass (class.js?_dc=92d18061f3cf12164c60e731f9a257d398049750:33:29)
    at script-proxy?storageFile=minified_javascript_core_2e45501b67c83d597d00e4a928b17891.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:12569:32
    at klass.fireEvent (script-proxy?storageFile=minified_javascript_core_2e45501b67c83d597d00e4a928b17891.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:10640:26)
    at klass.fire (script-proxy?storageFile=minified_javascript_core_2e45501b67c83d597d00e4a928b17891.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:12415:35)
    at klass.pimcoreReady (script-proxy?storageFile=minified_javascript_core_2e45501b67c83d597d00e4a928b17891.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:12384:14)
    at Object.executePlugin (script-proxy?storageFile=minified_javascript_core_261ec13a5a54a55d1e07f85446be1991.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:101165:27)
    at Object.fireEvent (script-proxy?storageFile=minified_javascript_core_261ec13a5a54a55d1e07f85446be1991.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:101179:22)
    at HTMLDocument.<anonymous> (script-proxy?storageFile=minified_javascript_core_261ec13a5a54a55d1e07f85446be1991.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:101211:35)
    at Object.onReady (script-proxy?storageFile=minified_javascript_core_261ec13a5a54a55d1e07f85446be1991.js&_dc=92d18061f3cf12164c60e731f9a257d398049750:109748:18)

Seems it didn´t affect functionality at the moment. So low priority.

Maybe an issue/side effect with the change in Pimcore 10.x: Plugins are deprecated. Please use event listener

dpfaffenbauer commented 1 year ago

@ITspirit is this still happening with the latest releases?

TheHeartfulGiant commented 1 year ago

@dpfaffenbauer Yes it is. Installed it on 10.6.1 in a fresh instance and got the same error.

script-proxy?storageFile=minified_javascript_core_e0dbe71e2738eb11cea0b915b889fbce.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:101562 TypeError: Cannot read properties of undefined (reading 'coreshop')
    at klass.initialize (script-proxy?storageFile=minified_javascript_core_0941271ef23e77bfb4fb6096a3bf5006.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:19582:27)
    at new klass (class.js?_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:33:29)
    at script-proxy?storageFile=minified_javascript_core_0941271ef23e77bfb4fb6096a3bf5006.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:19615:5
    at klass.fireEvent (script-proxy?storageFile=minified_javascript_core_0941271ef23e77bfb4fb6096a3bf5006.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:997:26)
    at klass.fire (script-proxy?storageFile=minified_javascript_core_0941271ef23e77bfb4fb6096a3bf5006.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:2772:35)
    at klass.pimcoreReady (script-proxy?storageFile=minified_javascript_core_0941271ef23e77bfb4fb6096a3bf5006.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:2741:14)
    at Object.executePlugin (script-proxy?storageFile=minified_javascript_core_e0dbe71e2738eb11cea0b915b889fbce.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:101537:27)
    at Object.fireEvent (script-proxy?storageFile=minified_javascript_core_e0dbe71e2738eb11cea0b915b889fbce.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:101551:22)
    at HTMLDocument.<anonymous> (script-proxy?storageFile=minified_javascript_core_e0dbe71e2738eb11cea0b915b889fbce.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:101583:35)
    at Object.onReady (script-proxy?storageFile=minified_javascript_core_e0dbe71e2738eb11cea0b915b889fbce.js&_dc=ec3e8a2abe625f2ade45ee1b62cd79947b90f58f:110130:18)

Maybe it is part of this

GET https://pimcore10-coreshop.ddev.site/admin/coreshop/coreshop.main/menu.js net::ERR_ABORTED 500

EDIT:

It is related to the file and the trigger_deprecation function. They is only one Argument given but two expected.

# vendor/pimcore/pimcore/bundles/AdminBundle/Security/User/User.php

trigger_deprecation(
    'pimcore/pimcore',
    '10.6',
    'The "%s" class is deprecated and will be removed in Pimcore 11. Use %s instead.',
    [User::class, PimcoreUser::class]
);
dpfaffenbauer commented 1 year ago

I already created a PR on Pimcore to fix it. Nothing we can do until 10.6.2 is released

TheHeartfulGiant commented 1 year ago

@dpfaffenbauer Thanks for the Information :)