Skip to content

fix(sentry-apps): Omit empty optional fields from issue-link submissions#116757

Merged
priscilawebdev merged 1 commit into
masterfrom
priscilawebdev/fix/sentry-apps-omit-empty-optional-issue-link-fields
Jun 3, 2026
Merged

fix(sentry-apps): Omit empty optional fields from issue-link submissions#116757
priscilawebdev merged 1 commit into
masterfrom
priscilawebdev/fix/sentry-apps-omit-empty-optional-issue-link-fields

Conversation

@priscilawebdev

@priscilawebdev priscilawebdev commented Jun 3, 2026

Copy link
Copy Markdown
Member

Strip empty values from the Sentry App issue-link form payload before submit.

Why

The migrated form's adapter seeds every field with a value, so an untouched optional select submits as <field>_id: null. The legacy FormModel left untouched fields undefined, which JSON.stringify dropped — so they were never sent. Some external integrations reject these unexpected null ids, surfacing as a 500 from …/external-issue-actions/. This restores the prior wire behavior.

Fix

Filter out empty values before they hit the request body, reusing the form's existing hasValue helper (via lodash/omitBy): ...omitBy(values, value => !hasValue(value)). This drops null/undefined/'' while keeping meaningful values like 0/"0". Scoped to the sentry-app form, not the shared adapter, since other consumers may treat null as meaningful.

Regression test added; existing tests, typecheck, and lint pass.

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 3, 2026
@priscilawebdev priscilawebdev force-pushed the priscilawebdev/fix/sentry-apps-omit-empty-optional-issue-link-fields branch from ba1ce3c to 8fb04d8 Compare June 3, 2026 11:09
The migrated Sentry App schema form seeds every field with a value via the
form adapter (untouched single selects become null), and JSON.stringify keeps
nulls — so an untouched optional select is submitted as `<field>_id: null`.
The legacy FormModel left untouched fields undefined, which JSON.stringify
dropped, so they were never sent.

Strict integrators reject a payload full of null ids. Shortcut's create form
has seven optional id selects, so it saw a sharp rise in 400s after the form
migration rolled out, while integrations with fewer optional selects (e.g.
Linear) were largely unaffected. These failures surfaced as 500s in the issue
stream because the backend wraps the integrator 4xx as a 500.

Strip null/undefined/empty-string/empty-array values from the form payload
before submitting, restoring the previous wire behavior. Scoped to the
sentry-app form rather than the shared BackendJsonSubmitForm adapter, since
other consumers may treat null as meaningful.

Co-Authored-By: Claude <noreply@anthropic.com>
@priscilawebdev priscilawebdev force-pushed the priscilawebdev/fix/sentry-apps-omit-empty-optional-issue-link-fields branch from 8fb04d8 to 3731c35 Compare June 3, 2026 11:24
@priscilawebdev priscilawebdev marked this pull request as ready for review June 3, 2026 11:30
@priscilawebdev priscilawebdev requested a review from a team as a code owner June 3, 2026 11:30
@priscilawebdev priscilawebdev requested a review from a team June 3, 2026 11:31
...values,
// The adapter seeds untouched fields (selects become null); the legacy
// FormModel sent only filled values, so reuse hasValue to drop empties.
...omitBy(values, value => !hasValue(value)),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just to be sure. Does this still allow us to unset an optional field (e.g. change from 'value' to '')?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This path only creates a new external issue (it doesn't edit one), so there's no existing value to unset - an empty optional just isn't set on the new issue, same as the old FormModel, which already dropped empties. The flow where clearing a saved value matters (alert-rule-action) returns early in handleSubmit and sends all values including '', so it's unaffected.

@priscilawebdev priscilawebdev merged commit 4bd2048 into master Jun 3, 2026
78 checks passed
@priscilawebdev priscilawebdev deleted the priscilawebdev/fix/sentry-apps-omit-empty-optional-issue-link-fields branch June 3, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants