Skip to content

Fix CI Failures by Adding User-Agent Header to node:https get method#76

Closed
Henry-Hong wants to merge 2 commits intoalexeyraspopov:mainfrom
Henry-Hong:main
Closed

Fix CI Failures by Adding User-Agent Header to node:https get method#76
Henry-Hong wants to merge 2 commits intoalexeyraspopov:mainfrom
Henry-Hong:main

Conversation

@Henry-Hong
Copy link
Copy Markdown
Contributor

Description

  • Recent PRs for this repository have been experiencing CI failures.
    image
  • The reason for the CI failure is that benchmark.yaml is trying to send requests to the Bundlephobia API. However, their policy has changed, and they are now enforcing a whitelist policy.
  • To resolve this issue, I have submitted a PR to the Bundlephobia repository to get API access. You can view the PR here
  • According to their API policy, requests to the Bundlephobia API must include a "User-Agent" header.
  • So I added "user-agent : picocolors" as follows.
image

@Henry-Hong Henry-Hong changed the title Fix CI(benchmark) error Fix CI Failures by Adding User-Agent Header to Requests in benchmark.yaml Aug 2, 2024
@Henry-Hong Henry-Hong changed the title Fix CI Failures by Adding User-Agent Header to Requests in benchmark.yaml Fix CI Failures by Adding User-Agent Header to node:https get method Aug 2, 2024
styfle pushed a commit to styfle/packagephobia that referenced this pull request Aug 3, 2024
Hi 👋

This PR adds [picocolors](https://github.com/alexeyraspopov/picocolors)
to the list

As you can see, picocolors using API from packagephobia but get
`Forbidden` error because of API block policy.

And don't worry. I set appropriate user-agent header too
[here](alexeyraspopov/picocolors#76).

<img width="755" alt="image"
src="https://github.com/user-attachments/assets/4043866a-9d9f-47bb-8b85-0194e139ded8">
async function getJSON(url) {
return new Promise(resolve => {
get(url, res => {
get(url, { headers: {"user-agent": 'picocolors'} },res => {
Copy link
Copy Markdown

@styfle styfle Aug 8, 2024

Choose a reason for hiding this comment

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

Suggested change
get(url, { headers: {"user-agent": 'picocolors'} },res => {
get(url, { headers: {"user-agent": 'picocolors-size-benchmark'} },res => {

Let’s be more specific since picocolors doesn’t make API calls during runtime, only during this benchmark.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That make sense. Here's commit you ordered! 6285808

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@alexeyraspopov

Sorry to tag you, but can you check this PR please? Thanks.

styfle added a commit to styfle/packagephobia that referenced this pull request Aug 10, 2024
as-is : picocolors
to-be : picocolors-size-benchmark

Changed name since picocolors use API call only when size benchmark. 

Thanks!

related : alexeyraspopov/picocolors#76

---------

Co-authored-by: Steven <steven@ceriously.com>
@Henry-Hong Henry-Hong requested a review from styfle August 16, 2024 02:46
@alexeyraspopov
Copy link
Copy Markdown
Owner

Looks like bundlephobia no longer available as dedicated API. I reworked the size benchmark in #86

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.

3 participants