Skip to content

Fix: function data action retry#2179

Open
luroess wants to merge 3 commits intoMyPureCloud:devfrom
luroess:bug/function-data-action-retry
Open

Fix: function data action retry#2179
luroess wants to merge 3 commits intoMyPureCloud:devfrom
luroess:bug/function-data-action-retry

Conversation

@luroess
Copy link

@luroess luroess commented Mar 2, 2026

Hello,
we encountered following issue with RetryWhen, the retry only happens when resp != nil && shouldRetry(resp, ...). The functions updateFunctionDataActionDraft & createFunctionDataActionDraft were returning nil as the response on failure. This meant resp != nil was false, so RetryWhen skipped retrying and making the backoff completely useless. This error was encountered during uploading multiple files in parallel and causing publish failures.

Changes:

  • fix: retries publishing action
  • fix: improved docu and regex for function data actions

Thank you in advance I would appreciate a review and testing from Genesys side.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a retry bug in the RetryWhen-based publish flow for function data actions. When publishIntegrationActionDraft failed, the callback was returning (nil, err). Because RetryWhen only retries when resp != nil && shouldRetry(resp, ...), a nil response caused retrying to be silently skipped, making the exponential backoff completely useless during parallel file uploads. The fix returns resp (instead of nil) on failure so the retry condition can be evaluated properly.

Changes:

  • Fix updateFunctionDataActionDraft and createFunctionDataActionDraft to return the actual resp (not nil) on publish failure, enabling proper retry behavior.
  • Extend containsFunctionDataAction to also normalize hyphens to spaces (alongside existing underscore normalization), and update schema/docs descriptions accordingly.
  • Correct the documentation example to use a category ("Genesys Cloud Function Data Action") that actually matches the function data action detection logic.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
genesyscloud/integration_action/resource_genesyscloud_integration_action.go Returns resp on publish failure (core fix); adds debug log statements with a nil-dereference risk
genesyscloud/integration_action/resource_genesyscloud_integration_action_schema.go Updates category field description to document function data action detection behavior
docs/resources/integration_action.md Corrects example category, expands doc comments to accurately describe detection logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

resp, err := iap.publishIntegrationActionDraft(ctx, id, version+1)
if err != nil {
return nil, util.BuildAPIDiagnosticError(ResourceType, fmt.Sprintf("Failed to publish integration action %s error: %s", name, err), resp)
log.Printf("DEBUG: Publish failed with status %d", resp.StatusCode)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if err != nil {
if resp != nil {
log.Printf("DEBUG: Publish failed with status %d", resp.StatusCode)
}
return resp, ...
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once this is done. will merge the PR. @luroess

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

3 participants