Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove fetch override for octokit and versions #4042

Merged
merged 5 commits into from
Aug 7, 2024

Conversation

npalm
Copy link
Collaborator

@npalm npalm commented Aug 6, 2024

Problem

Updating octkit auth app to 6.1.1. fails runtime. Not in our tests due to most of the SDK layer is mocked.

Only information we catch is a generic Error.

 HttpError: response.json(...).catch is not a function

Via issue @wolfy1339 provides feedback that the cause could be related to overriding the fetch in octokit. In PR #3554 where tracing was introduced also the fetch command was overriden, this due the fact the node fetch was not working properly for tracing HTTP calls, which are in our case the cals to GitHub. This problem seems now to be fixed in the AWS xray sdk.

Solution

The solution is quite simple. Just remove axios as fetch implementation (override) and use the default provide by octokit.

Testing

The problem was not detected in the unit tests. Reason is that the unit test mocking the octokit SDK. In case of an ovrride we have doen. We hsould have added a test using nock to mock the HTTP calls and not the full SDK to catch problems like this in the unit test. By removing the override, we can relay again on the test efforts done by octokit.

References

@npalm npalm changed the base branch from main to npalm/update-octokit-auth August 6, 2024 12:57
@npalm npalm marked this pull request as draft August 6, 2024 17:21
@npalm npalm marked this pull request as ready for review August 7, 2024 12:07
@npalm npalm changed the title fix: update octokit auth from 6.1.0 to 6.1.1 fix: remove fetch override for octokit and versions Aug 7, 2024
@npalm npalm changed the base branch from npalm/update-octokit-auth to main August 7, 2024 12:07
@npalm npalm force-pushed the npalm/update-octokit-auth-611 branch from 9da9465 to ba5300e Compare August 7, 2024 12:16
@npalm npalm requested a review from stuartp44 August 7, 2024 12:16
@npalm
Copy link
Collaborator Author

npalm commented Aug 7, 2024

Tested with the default example:

Logs scale-up
image

Tracing example. Removing the axios fetch does NOT break the tracing of the github calls.
image

@npalm npalm requested a review from Brend-Smits August 7, 2024 12:34
Copy link
Contributor

@stuartp44 stuartp44 left a comment

Choose a reason for hiding this comment

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

LGTM

@npalm npalm merged commit 6ac19e6 into main Aug 7, 2024
4 checks passed
@npalm npalm deleted the npalm/update-octokit-auth-611 branch August 7, 2024 13:01
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.

Upgrade ockokit/rest and octokit/auth-app breaks scale-up during authorization
2 participants