fix(sentry-apps): Omit empty optional fields from issue-link submissions#116757
Merged
priscilawebdev merged 1 commit intoJun 3, 2026
Conversation
ba1ce3c to
8fb04d8
Compare
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>
8fb04d8 to
3731c35
Compare
ArthurKnaus
reviewed
Jun 3, 2026
| ...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)), |
Member
There was a problem hiding this comment.
Just to be sure. Does this still allow us to unset an optional field (e.g. change from 'value' to '')?
Member
Author
There was a problem hiding this comment.
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.
ArthurKnaus
approved these changes
Jun 3, 2026
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
selectsubmits as<field>_id: null. The legacyFormModelleft untouched fieldsundefined, whichJSON.stringifydropped — so they were never sent. Some external integrations reject these unexpectednullids, 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
hasValuehelper (vialodash/omitBy):...omitBy(values, value => !hasValue(value)). This dropsnull/undefined/''while keeping meaningful values like0/"0". Scoped to the sentry-app form, not the shared adapter, since other consumers may treatnullas meaningful.Regression test added; existing tests, typecheck, and lint pass.