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: add node-fetch v2 for script automation and keep node-fetch v3 #3038

Merged

Conversation

jerensl
Copy link
Contributor

@jerensl jerensl commented Jun 11, 2024

Description
Based on node-fetch documentation, they are just supporting ESM for v3, so I added v2 which I'm naming node-fetch-2 to make the Automated listing of meetings and other data work again, assuming node-fetch v3 is dependent on another thing.

Related issue(s)
Fixes #3036
fixes #3052

Copy link

netlify bot commented Jun 11, 2024

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1cf54f8
🔍 Latest deploy log https://app.netlify.com/sites/asyncapi-website/deploys/6697ef0003384d0008968a88
😎 Deploy Preview https://deploy-preview-3038--asyncapi-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@asyncapi-bot
Copy link
Contributor

asyncapi-bot commented Jun 11, 2024

⚡️ Lighthouse report for the changes in this PR:

Category Score
🔴 Performance 34
🟢 Accessibility 98
🟢 Best practices 92
🟢 SEO 100
🟠 PWA 56

Lighthouse ran on https://deploy-preview-3038--asyncapi-website.netlify.app/

@jerensl jerensl changed the title fix(automation-script): rollback node-fetch from v3 to v2 fix(automation-script): add node-fetch v2 for script automation and keep node-fetch v3 Jun 12, 2024
@@ -79,6 +79,7 @@
"next": "14.1.1",
"next-mdx-remote": "^4.4.1",
"node-fetch": "^3.3.2",
"node-fetch-2": "npm:node-fetch@^2.7.0",
Copy link
Member

Choose a reason for hiding this comment

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

why npm:node-fetch@^2.7.0 and not just node-fetch@^2.7.0 ?

also maybe you could also update the other script that uses node-fetch, so there will be no need for node-fetch-2?

or maybe best solution is just to update https://github.com/asyncapi/website/blob/master/.github/workflows/regenerate-meetings-and-videos.yml#L28 that rungs this script. v4 is using node 20 by default - wouldn't that fix the issue? using v20 instead of v16 of node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current node-fetch v3 is being used by the website only supports ESM modules, so I try to keep 2 versions.

Another solution is to migrate to ESM from CommonJS, I don't like this idea unless we are using Deno or Webpack to bundle the script, the primary reason is by the end of the day webpack or another tool will always bundle ESM to CommonJS in production.

It reminds me of the old days when this pissed a lot of people including me and almost break the entire javascript ecosystem xD
https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

@derberg
Copy link
Member

derberg commented Jul 15, 2024

@anshgoyalevil can we somehow push it forward? @akshatnema had a short chat with me in DM, that probably some things will be removed during GSoC but this PR is fixing a bug, like you know, meetings and other stuff are not update on website for very long. Maybe we can merge it as at least temporary solution, that later can be improved during GSoC

@derberg derberg changed the title fix(automation-script): add node-fetch v2 for script automation and keep node-fetch v3 fix: add node-fetch v2 for script automation and keep node-fetch v3 Jul 15, 2024
@akshatnema
Copy link
Member

Yeah, let's merge it for now.

@anshgoyalevil Can you please review the PR?

@sambhavgupta0705 please make an issue to setup ts-node configuration and migrate scripts in ts.

@anshgoyalevil
Copy link
Member

The solution is pretty good for short term. Let's merge it in and see how the failing workflows goes hereafter.

@sambhavgupta0705
Copy link
Member

Merging it for now and creating a new issue for future

@sambhavgupta0705
Copy link
Member

/rtm

@asyncapi-bot
Copy link
Contributor

Hello, @sambhavgupta0705! 👋🏼
This PR is not up to date with the base branch and can't be merged.
Please update your branch manually with the latest version of the base branch.
PRO-TIP: To request an update from the upstream branch, simply comment /u or /update and our bot will handle the update operation promptly.

       The only requirement for this to work is to enable [Allow edits from maintainers](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) option in your PR. Also the update will not work if your fork is located in an organization, not under your personal profile.
       Thanks 😄

@sambhavgupta0705
Copy link
Member

/update

@sambhavgupta0705
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit 62afd39 into asyncapi:master Jul 17, 2024
15 checks passed
@akshatnema
Copy link
Member

@jerensl
Copy link
Contributor Author

jerensl commented Jul 20, 2024

@jerensl @anshgoyalevil @sambhavgupta0705 The workflow is still failing - https://github.com/asyncapi/website/actions/runs/10015997000/job/27688324771

I made a new PR addressing that issue, i not realizing there another components nested deep inside scripts using node-fetch as well. This new PR should fix the issues https://github.com/asyncapi/website/pull/3099/files

@derberg
Copy link
Member

derberg commented Aug 26, 2024

@akshatnema @anshgoyalevil @sambhavgupta0705 folks is there a better way to handle issues like this one, with higher priority or something, from triage to review and merge. This https://github.com/asyncapi/website/actions/workflows/regenerate-meetings-and-videos.yml workflow that is important for transparency and increase in community participation is failing like for super super long

@sambhavgupta0705
Copy link
Member

@derberg I am reopenjng the issue and we will look into it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] <description> Automated listing of meetings and other data fails since 2 weeks
6 participants