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

Amazon\Pay\Model\CustomerManagement::setAmazonIdExtensionAttribute - Caching does not handle missing amazon user (Remains null) #1254

Open
steven-hoffman-jomashop opened this issue Nov 20, 2024 · 2 comments

Comments

@steven-hoffman-jomashop

What I expected

For Amazon\Pay\Model\CustomerManagement::setAmazonIdExtensionAttribute:

  • $this->customerLinkManagement->getByCustomerId($customer->getId()); is only called once (Per customer).

What happened instead

  • $this->customerLinkManagement->getByCustomerId($customer->getId()); returns an empty object
  • $amazonCustomer->getId() as false
  • $this->amazonId remains null

Steps to reproduce the issue

Call into Amazon\Pay\Model\CustomerManagement::setAmazonIdExtensionAttribute multiple times.

Possible Fix

  • Set $this->amazonId to something non-null that is falsy (0, '', false)
  • Then it will not load and will not set the value to the extension attribute

Your setup

@sgabhart22
Copy link
Contributor

Hi @steven-hoffman-jomashop ,

Does this manifest in the shopper's experience somehow, and if so, could you please provide an example? e.g., duplicated quotes, cart being emptied unexpectedly, etc. A few more details would help us debug and remediate more effectively.

Thanks,
Spencer

@steven-hoffman-jomashop
Copy link
Author

Hi @sgabhart22,

This would not 'manifest' to the customer; aside from a slower response time.
The issue is that the caching logic does not 'consider' a null response as a 'cachable' response.
As such the caching logic does not handle a missing 'customer link' and will repeat the query to the database if the same customer model is requested again.

In Summary, this is a performance issue, not a bug in 'behavior'.

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