Add to basket error

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
subash
Posts: 5
Joined: 31 Jan 2023, 22:45

Add to basket error

Post by subash » 02 Feb 2023, 07:03

Hi

"php": "^8.0.10", "aimeos/ai-payments": "^2022.10","aimeos/aimeos-laravel": "^2022.10",
"laravel/framework": "^9.2", "omnipay/stripe": "^3.2", OS: Linux

When we click on add to basket button, we are getting 419 error, but it's working after we logged to the portal. this issue happens randomly when without logging in. please assist me with this. attached is the screenshot. Thank you
Attachments
419error
419error
419error.png (11.97 KiB) Viewed 2032 times
addtobasketerror
addtobasketerror
addtobasketerror.png (6.66 KiB) Viewed 2032 times
addtobasket
addtobasket
addtobasket.png (4.69 KiB) Viewed 2032 times

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: Add to basket error

Post by aimeos » 02 Feb 2023, 08:29

HTTP status 419 is used by Laravel to indicate that the CSRF token is not sent or invalid.
Did you change the template?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

subash
Posts: 5
Joined: 31 Jan 2023, 22:45

Re: Add to basket error

Post by subash » 02 Feb 2023, 08:43

I didn't change the template, but it happens before log in on randomly.

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: Add to basket error

Post by aimeos » 02 Feb 2023, 08:47

Most likely, an old CSRF token is sent to the server when adding a product to the basket. Caching could be a problem and you can disable it in your ./config/shop.php ("madmin" section) for testing.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

subash
Posts: 5
Joined: 31 Jan 2023, 22:45

Re: Add to basket error

Post by subash » 02 Feb 2023, 08:59

if I disable madmin section, no error is appearing but the site loses performance. Thank you

User avatar
aimeos
Administrator
Posts: 7881
Joined: 01 Jan 1970, 00:00

Re: Add to basket error

Post by aimeos » 02 Feb 2023, 10:12

Found the problem (a wrong key for replacing the CSRF tokens). Can you please install the -dev version, enable caching and test again?

Code: Select all

composer req aimeos/ai-client-html:2022.10.x-dev
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

subash
Posts: 5
Joined: 31 Jan 2023, 22:45

Re: Add to basket error

Post by subash » 02 Feb 2023, 10:46

Thank you! its working now

Post Reply