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

[BUG] Latest version of the connector causes System.CalloutException #249

Open
ddxxtony opened this issue Jul 7, 2023 · 1 comment
Open
Labels
bug Something isn't working

Comments

@ddxxtony
Copy link

ddxxtony commented Jul 7, 2023

Describe the bug
If we use the latest version of the connector and a profile is created or updated from the storefront, we will encounter an error in the B2CCommerce_PlatformEvent_ProcessContactUpdate flow (see error below).

Debug the failed interview in Flow Builder for the interview GUID: 661641cf990704fd776128f0b240189308e9be1-2a0d
Error element ia_retrieveB2CCommerceCustomerProfile (FlowActionCall).
An Apex error occurred: System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

To Reproduce
Steps to reproduce the behavior:
First Issue

  1. Go to storefront
  2. Create a profile
  3. You will receive an email notifying you that there was an error with this flow: B2CCommerce_PlatformEvent_ProcessContactUpdate.

Second Issue(same issue with different steps)

  1. Go to storefront
  2. Access your account
  3. Update any information.
  4. You will receive an email notifying you that there was an error with this flow: B2CCommerce_PlatformEvent_ProcessContactUpdate.

Expected behavior
We should not receive any errors when a user signs in or signs up on the storefront.

Screenshots
image
image

Your local environment details:

  • Node version (node -v): v16.15.1
  • NPM version (npm -v) v8.11.0
  • SFDX version (sfdx -v) sfdx-cli/7.165.0 win32-x64 node-v16.15.1

Your remote environment details:

  • Salesforce B2C Commerce version: 21.03
  • Salesforce Core version: 58

Additional context
It seems like the maintainers have been trying to fix this issue for a long time. Initially, they solved it by adding pauses to the B2CContactProcess Flow, but this resulted in another error where SFCC wasn't receiving all the necessary information (Error Related to AccountID ). As a result, they removed the pause elements, which led to the reoccurrence of this issue.

Possible solution
I moved the event publishing in the B2CContactProcess flow to the end and added a pause element before it. The only issue with this change is that the flow status returned to SFCC is 'waiting', but it doesn't cause any problems. Apart from that, I haven't found any major issues. If you see any caveats, please let me know.

This fix solves the problem for this bug and the other bugs reported #163, #106, #115 .
image

@ddxxtony ddxxtony added the bug Something isn't working label Jul 7, 2023
@jbachelet
Copy link
Contributor

Hello,

Thanks for raising the issue.
Yes, I've been trying to solve this and reverted the change with the Pause element as it resulted in the fact that the flow was not returning to SFCC the AccountId and ContactId, which SFCC stores and reuses afterward.
Thus, this technical solution is not suitable here, and the only way to fix this from my POV is to rework the whole logic executed here.

This is a pending work in progress that I need to address, but no ETA so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants