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

Simultaneous calls to a new channel causes errors #834

Closed
karel-advantitge opened this issue Apr 21, 2021 · 0 comments
Closed

Simultaneous calls to a new channel causes errors #834

karel-advantitge opened this issue Apr 21, 2021 · 0 comments
Assignees
Labels
type: bug 🐛 Something isn't working

Comments

@karel-advantitge
Copy link
Contributor

Describe the bug
The AuthGuard checks whether the activeChannel on the session for an incoming request matches the channel of the requestcontext.
If this does not match the session, is updated and the customer performing the request is assigned to the active channel, using the function channelService.assignToChannels().
If a caller performs multiple simultaneous calls to new channel, this logic is executed for each of these calls simultaneaously. This calls the function channelService.assignToChannels() multiple times simultaneously with the same data. The first call succeeds, but the other calls result in an SQL error: ER_DUP_ENTRY: Duplicate entry '6-2' for key 'customer_channels_channel.PRIMARY'

To Reproduce
Steps to reproduce the behavior:

  1. Create a customer
  2. Perform multiple queries to the shop-api simultaneously with a vendure-token header of a channel the customer is not yet assigned to
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants