Skip to content

Conversation

@avivkeller
Copy link
Member

This PR:

  • Fixes the nasty fetch failed issue on deployments by rewriting the fetch statements to .then().catch() format
  • Adds a missing type file
  • Moves a constant to the constants file
  • Simplifies an object creation

Copilot AI review requested due to automatic review settings December 4, 2025 23:29
@avivkeller avivkeller requested a review from a team as a code owner December 4, 2025 23:29
@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nodejs-org Ready Ready Preview Dec 4, 2025 11:29pm

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

👋 Codeowner Review Request

The following codeowners have been identified for the changed files:

Team reviewers: @nodejs/nodejs-website

Please review the changes when you have a chance. Thank you! 🙏

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.39%. Comparing base (43ffe41) to head (6a3b0bb).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8395      +/-   ##
==========================================
- Coverage   76.40%   76.39%   -0.01%     
==========================================
  Files         118      118              
  Lines        9928     9924       -4     
  Branches      334      334              
==========================================
- Hits         7585     7581       -4     
  Misses       2341     2341              
  Partials        2        2              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copilot finished reviewing on behalf of avivkeller December 4, 2025 23:32
Copy link
Contributor

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 PR refactors data generator functions to use promise chain syntax (.then().catch()) instead of async/await, addressing fetch failures during deployments. The changes improve error handling by ensuring that failed fetch operations return safe default values instead of breaking the build.

Key Changes:

  • Refactored vulnerabilities.mjs and supportersData.mjs generators to use .then().catch() pattern with fallback values
  • Added supporters.ts type definitions file and exported it from the types index
  • Moved OPENCOLLECTIVE_MEMBERS_URL constant from inline definition to centralized next.constants.mjs

Reviewed changes

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

Show a summary per file
File Description
apps/site/types/supporters.ts Adds type definitions for Supporter and OpenCollectiveSupporter
apps/site/types/index.ts Exports the new supporters type module
apps/site/next.constants.mjs Adds OPENCOLLECTIVE_MEMBERS_URL constant for centralized configuration
apps/site/next-data/generators/vulnerabilities.mjs Refactors async function to arrow function with promise chains and error handling
apps/site/next-data/generators/supportersData.mjs Refactors async function to arrow function with promise chains, uses centralized constant

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

@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2025

📦 Build Size Comparison

Summary

Metric Value
Old Total Size 3.52 MB
New Total Size 3.52 MB
Delta 0 B (0.00%)

Changes

➕ Added Assets (1)
Name Size
.next/static/chunks/47f6daefe3158485.js 204.48 KB
➖ Removed Assets (1)
Name Size
.next/static/chunks/f0fd468782f70ba6.js 204.48 KB

@avivkeller
Copy link
Member Author

@nodejs/nodejs-website PTAL

source: string;
};

export type OpenCollectiveSupporter = Supporter & { source: 'opencollective' };
Copy link
Member

Choose a reason for hiding this comment

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

nit

Suggested change
export type OpenCollectiveSupporter = Supporter & { source: 'opencollective' };
export type OpenCollectiveSupporter = Supporter<'opencollective'>;

source: 'opencollective',
}))
)
.catch(() => []);
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if silently ignore the error is a good idea

Copy link
Member Author

Choose a reason for hiding this comment

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

What alternative did you have in mind?

Copy link
Member

@araujogui araujogui Dec 6, 2025

Choose a reason for hiding this comment

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

What was the initial problem? I'm not sure I understood it

Copy link
Member Author

Choose a reason for hiding this comment

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

Occassionally, the fetch will randomly fail for whatever reason (i.e. network failure, the website is down). This bubbles up and breaks the entire deployment.

Copy link
Member

Choose a reason for hiding this comment

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

I guess we should let it crash so we know something went wrong, rather than silently deploying a build with missing data

Copy link
Member

Choose a reason for hiding this comment

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

Yes, absolutely, it should crash, otherwise if this fails... Well, no data.

We could add retry-logic tho

// Helper function to process version patterns
const processVersion = (version, vulnerability) => {
// Handle 0.X versions (pre-semver)
if (/^0\.\d+(\.x)?$/.test(version)) {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe create a constant for these regex?

}

export default fetchOpenCollectiveData;
export default () =>
Copy link
Member

Choose a reason for hiding this comment

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

Can we go back to async please :D

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