Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product creation fails for shops with MYSQL_USER and MYSQL_PWD set #26

Closed
macster84 opened this issue Dec 24, 2020 · 3 comments
Closed

Comments

@macster84
Copy link
Contributor

Happy Christmas bug report!

Describe the bug
Product creation fails via new product page or import when MYSQL_USER and MYSQL_PWD are set.
The error is:
SQLSTATE[HY000]: General error: 1449 The user specified as a definer ('root'@'%') does not exist

This seems to be related to this line where root access is restricted to localhost once a MYSQL_USER is set.
Unfortunately Shopware defines database triggers that still reference 'root@%' as definer:

  • product_purchase_prices_insert
  • product_purchase_prices_update
  • product_listing_price_update

This can be easily seen when running 'show triggers' via mysql shell.

I eventually changed the definer manually to 'root@localhost' for all triggers like outlined here.
Afterwards product creation does not yield a 500 error anymore. Also import worked like a charm.

To Reproduce
Start dockware/dev with a MYSQL_USER and MYSQL_PWD.

version: "3.8"

services:
    shopware:
        image: dockware/dev:6.3.4.0
        container_name: shopware
        networks:
            - web
        environment:
            - XDEBUG_ENABLED=0
            - MYSQL_USER=app
            - MYSQL_PWD=app

networks:
    web:
        external: false

Afterwards try to create a product either by the new product page or by import.

Expected behavior
Product creation succeeds without errors.

Desktop (please complete the following information):

  • OS: macOS Catalina
  • Browser: Chrome
@boxblinkracer
Copy link
Collaborator

Happy Christmas :)

thank you for this bug report
mhm...ouch :D

i can indeed reproduce it, great preparation for this issue
ill figure out a good way for the triggers such as you've described

thanks
christian

@boxblinkracer
Copy link
Collaborator

alright
finished in one of the latest commits
thank you so much for your help

1736dc5

you can already build it yourself if you need it.
otherwise it should be published in a few days i think

i will now close this ticket

@macster84
Copy link
Contributor Author

Thanks a lot for your fix. :-)
Very much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants