You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR addresses a ZodError that occurred when the GraphQL API returned an HTTP 200 OK status, but the response body contained only an errors array and no data field. This is a valid GraphQL error response format.
Previously, the graphql() function in src/shared/api/api.ts would resolve the promise with this raw response body if res.ok was true. Consequently, consuming hooks like useOwner would receive an object where res?.data was undefined, leading to a ZodError when attempting to parse undefined as an object.
The fix modifies the graphql() function to explicitly reject the promise when res.ok is true, but the GraphQL response body contains errors and lacks a data field. This ensures that GraphQL errors are propagated as rejections, preventing undefined values from reaching Zod validation and eliminating the ZodError.
Code Example
The changes are primarily within the graphql() function in src/shared/api/api.ts.
Notable Changes
Modified the graphql() function to explicitly reject the promise when the HTTP status is 200 OK but the GraphQL response body contains an errors array and no data field. This ensures proper error propagation for GraphQL errors.
Screenshots
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
View the top 1 failed test(s) by shortest run time
src/pages/AccountSettings/tabs/YAML/YAML.test.jsx > YAMLTab > The api fails > The save button becomes unsaved changes and an error is displayed
Stack Traces | 1.05s run time
TestingLibraryElementError: Unable to find an element with the text: /Something went wrong/. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body
class=""
>
<div />
</body>
Ignored nodes: comments, script, style
<body
class=""
>
<div />
</body>
❯ waitForWrapper node_modules/@.../dom/dist/wait-for.js:163:27
❯ node_modules/@.../dom/dist/query-helpers.js:86:33
❯ .../tabs/YAML/YAML.test.jsx:225:47
Seer wants to keep iterating on this pull request to get CI passing, but the Sentry GitHub App installation is missing permissions it needs to read the failing checks and push a fix.
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
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.
Description
This PR addresses a
ZodErrorthat occurred when the GraphQL API returned an HTTP 200 OK status, but the response body contained only anerrorsarray and nodatafield. This is a valid GraphQL error response format.Previously, the
graphql()function insrc/shared/api/api.tswould resolve the promise with this raw response body ifres.okwas true. Consequently, consuming hooks likeuseOwnerwould receive an object whereres?.datawasundefined, leading to aZodErrorwhen attempting to parseundefinedas an object.The fix modifies the
graphql()function to explicitly reject the promise whenres.okis true, but the GraphQL response body containserrorsand lacks adatafield. This ensures that GraphQL errors are propagated as rejections, preventingundefinedvalues from reaching Zod validation and eliminating theZodError.Code Example
The changes are primarily within the
graphql()function insrc/shared/api/api.ts.Notable Changes
Modified the
graphql()function to explicitly reject the promise when the HTTP status is 200 OK but the GraphQL response body contains anerrorsarray and nodatafield. This ensures proper error propagation for GraphQL errors.Screenshots
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
Fixes GAZEBO-1878
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this runThis PR was automatically generated by Sentry. You can adjust this setting at any time.