Skip to content

Surface an error when the webhook credential type lookup returns nothing#390

Merged
cigamit merged 3 commits into
ctrliq:mainfrom
blaipr:fix/webhook-subform-error-handling
Jun 12, 2026
Merged

Surface an error when the webhook credential type lookup returns nothing#390
cigamit merged 3 commits into
ctrliq:mainfrom
blaipr:fix/webhook-subform-error-handling

Conversation

@blaipr

@blaipr blaipr commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

Fixes the second documented known-bug from the UI gaps list. WebhookSubForm looks up the <service>_token credential type to drive the Webhook Credential field, but when the API responds successfully with no results, the field silently never rendered (there's an explicit TODO at the lookup acknowledging this) — users selecting a webhook service got no credential field and no explanation.

  • The form now renders an inline warning Alert when a webhook service is selected but no matching credential type could be resolved, instead of failing silently.
  • Also fixes a secondary bug on the same screen: webhook-key failures rendered <ContentError error={error} /> with the wrong (undefined) error object when only webhookKeyError was set.
  • The new string is not yet in the locale catalogs (deliberately, to keep this PR free of whole-catalog churn); it falls back to its English source text at runtime and will be picked up by the next routine extract-strings run.

Worth noting: the pre-existing test suite ran entirely in the silent-failure regime — the auto-mocked CredentialTypesAPI returned no credential type and nothing asserted the lookup's presence. The new tests cover both sides: the lookup renders when a type resolves, and the warning appears (lookup absent) on empty results.

No dependency, lockfile or locale-catalog changes. Independent of every other open PR — verified conflict-free via pairwise git merge-tree.

ISSUE TYPE

  • Bug, Docs Fix or other nominal change

COMPONENT NAME

  • UI

ASCENDER VERSION

awx: 25.4.1.dev5+gcda0899.d20260610

ADDITIONAL INFORMATION

npm --prefix awx/ui run lint     # clean
npm --prefix awx/ui run test     # 544 suites, 2857 passed (incl. 2 new)
npm --prefix awx/ui run build    # succeeds

WebhookSubForm looked up the '<service>_token' credential type to drive
the Webhook Credential lookup, but when the API responded successfully
with no results the field silently never rendered (an explicit TODO in
the code) - users selecting a webhook service got no credential field
and no explanation.

The lookup now renders an inline warning Alert when a webhook service
is selected but no matching credential type could be resolved. Also
fixes the error page for webhook-key failures, which rendered
ContentError with the wrong (undefined) error object when only
webhookKeyError was set.

Locale catalogs re-extracted for the new string (msgstr left for
translators, per convention). The new tests cover both the rendered
lookup on success and the warning on empty results - notably the
pre-existing suite ran entirely in the silent-failure regime, since the
auto-mocked CredentialTypesAPI returned no credential type and nothing
asserted the lookup's presence.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 updates the Template webhook subform in the AWX UI to avoid a silent failure when a selected webhook service cannot be mapped to a corresponding *_token credential type, and fixes an error-propagation issue for webhook-key failures.

Changes:

  • Render an inline warning Alert when a webhook service is selected but no credential type can be resolved, instead of rendering nothing.
  • Fix ContentError wiring so webhook-key failures display the correct error object.
  • Add/extend unit tests to cover both the “credential type resolves” and “no results” behaviors.

Reviewed changes

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

File Description
awx/ui/src/screens/Template/shared/WebhookSubForm.js Adds an inline warning alert for missing credential-type lookups; fixes the error passed into ContentError.
awx/ui/src/screens/Template/shared/WebhookSubForm.test.js Adds tests to assert credential lookup renders when a type resolves and that a warning renders when no type is found.

Comment thread awx/ui/src/screens/Template/shared/WebhookSubForm.test.js Outdated
Comment thread awx/ui/src/screens/Template/shared/WebhookSubForm.test.js Outdated
Comment thread awx/ui/src/screens/Template/shared/WebhookSubForm.test.js
- wait for the async credential-type lookup to settle (waitForElement on
  ContentLoading) instead of asserting right after mount
- mock CredentialsAPI.read/readOptions with complete response shapes in
  the success-path test so CredentialLookup actually renders instead of
  sitting in a silent error state (which surfaced a missing count field
  in the original mock)
@blaipr

blaipr commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

All three comments addressed: both new tests now wait for the async credential-type lookup to settle (waitForElement on ContentLoading) instead of asserting after mount, and the success-path test mocks CredentialsAPI.read/readOptions with complete response shapes so CredentialLookup actually renders — which immediately surfaced the missing count field the silent-error state had been hiding, validating the concern. 6 passed.

@blaipr

blaipr commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

All review feedback on this PR is addressed, and after the latest merges to main (#376, #380, #386, #389, #391, #394) this branch has been re-verified: it merges cleanly into current main (51188f0) and is conflict-free against every other open PR (git merge-tree, all pairs). Ready to merge — in any order relative to #385/#390/#392/#393/#395.

The comment asked how to handle an empty credential-type result; the
inline warning Alert added here is that handling.
@cigamit cigamit merged commit 803468a into ctrliq:main Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants