Skip to content

Comments

ACNA-3570: Append x-request-id header to error if present#121

Merged
hannah-taub-1 merged 3 commits intomasterfrom
ACNA-3570/expose-error-headers
Jan 26, 2026
Merged

ACNA-3570: Append x-request-id header to error if present#121
hannah-taub-1 merged 3 commits intomasterfrom
ACNA-3570/expose-error-headers

Conversation

@hannah-taub-1
Copy link
Contributor

Description

If an error object has headers, append these headers to the error message returned by reduceError.

Related Issue

https://jira.corp.adobe.com/browse/ACNA-3570

Motivation and Context

How Has This Been Tested?

Created a local script that called sdk.init() with invalid credentials and checked that headers appeared in the error message. Updated unit tests to check for header error output.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Member

@purplecabbage purplecabbage left a comment

Choose a reason for hiding this comment

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

🫖

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds functionality to include response headers in error messages generated by the reduceError helper function. This enhancement provides additional debugging context when API calls fail by exposing header information that may be relevant for troubleshooting.

Changes:

  • Modified reduceError function to append response headers to error messages when present
  • Added test case to verify headers are included in error output

Reviewed changes

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

File Description
src/helpers.js Updated reduceError function to append stringified headers to error message
test/helpers.test.js Added test case verifying header inclusion in error message output

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@pru55e11 pru55e11 left a comment

Choose a reason for hiding this comment

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

I agree with copilot on this one, we probably should filter the headers for sensitive responses and add a check/tests for an empty object - @shazron WDYT?

@shazron
Copy link
Member

shazron commented Jan 22, 2026

I agree with copilot on this one, we probably should filter the headers for sensitive responses and add a check/tests for an empty object - @shazron WDYT?

Actually the JIRA issue specifically required to include only specific headers, not all headers. We only need the Console API's request id (not sure which, this needs to be determined through experimentation). We can't play whack-a-mole with filtering headers if the Console API changes in the future to include new sensitive headers - so this approach should not be used.

I propose only an allowlist of headers to show: only the request id for now.

@hannah-taub-1
Copy link
Contributor Author

The JIRA ticket mentioned x-request-id, but also said "other relevant headers". Are there any other headers I should add beyond x-request-id?

@shazron
Copy link
Member

shazron commented Jan 22, 2026

The JIRA ticket mentioned x-request-id, but also said "other relevant headers". Are there any other headers I should add beyond x-request-id?

Let's just add that 1 specific header for now.

@hannah-taub-1 hannah-taub-1 merged commit 4e00e29 into master Jan 26, 2026
11 checks passed
@hannah-taub-1 hannah-taub-1 changed the title ACNA-3570: Append all headers to error if present ACNA-3570: Append x-request-id header to error if present Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants