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 CI Failures by Adding User-Agent Header to node:https get method #76

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Henry-Hong
Copy link
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">
@@ -6,7 +6,7 @@ let { bold, gray } = require("../picocolors.js")

async function getJSON(url) {
return new Promise(resolve => {
get(url, res => {
get(url, { headers: {"user-agent": 'picocolors'} },res => {
Copy link

@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
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
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
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.

2 participants