Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Headers aren't included in GraphQL error (maybe REST too) #553

Closed
1 task done
mariusa opened this issue Oct 7, 2022 · 3 comments · Fixed by #655 or #785
Closed
1 task done

Headers aren't included in GraphQL error (maybe REST too) #553

mariusa opened this issue Oct 7, 2022 · 3 comments · Fixed by #655 or #785

Comments

@mariusa
Copy link

mariusa commented Oct 7, 2022

Issue summary

Hi, the headers are not included in response when there's an error:

let products;
try {
  products = await client.query({
    data: `{
        products (first: 10) {
          edges {
            node {
              id
              title
              descriptionNotExistentToGetERror
            }
          }
        }
      }`,
  });
} catch (error) {
  if (error instanceof ShopifyErrors.GraphqlQueryError) {
// goes here
   //error.response.errors is set
// err.response.headers  is not set
  } else {
    // handle other errors
  }
  // the entire err object doesn't include any headers
}

Expected behavior

err should include response.headers, but it's not included. Shopify code:

 throw new ShopifyErrors.GraphqlQueryError({
                                message: 'GraphQL query returned errors',
                                response: result.body,
                            });

Checklist

  • I have described this issue in a way that is actionable (if possible)

See also #340

@zloz
Copy link

zloz commented Jan 6, 2023

Hi,

What is the status of this. This is useful as error headers include RetryAfter header, which is helpful in rate limiting errors like throttled cases

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

This issue is stale because it has been open for 90 days with no activity. It will be closed if no further action occurs in 14 days.

@github-actions github-actions bot added the Stale label Mar 8, 2023
@mariusa
Copy link
Author

mariusa commented Mar 8, 2023

not stale

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants