Skip to content

Comments

fix: update code to support @octokit/request v9 and @octokit/graphql v8#3697

Closed
AritraDey-Dev wants to merge 30 commits intoasyncapi:masterfrom
AritraDey-Dev:fix-octokit-upgrade
Closed

fix: update code to support @octokit/request v9 and @octokit/graphql v8#3697
AritraDey-Dev wants to merge 30 commits intoasyncapi:masterfrom
AritraDey-Dev:fix-octokit-upgrade

Conversation

@AritraDey-Dev
Copy link

@AritraDey-Dev AritraDey-Dev commented Feb 17, 2025

fixes #3690
Description
Update package.json to support @octokit/request v9.2.2 and @octokit/graphql v8.2.1.

  • Update @octokit/graphql to version 8.2.1.
  • Add @octokit/request with version 9.2.2.

Summary by CodeRabbit

  • Chores
    • Updated and reorganized dependencies for improved development and runtime management.
    • Enhanced Jest configuration for better compatibility with certain packages.
  • Refactor
    • Simplified authentication handling for GitHub API requests to streamline internal processes.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2025

Walkthrough

The changes update the package.json to add @octokit/graphql version ^8.2.2 as a devDependency while retaining version ^7.0.2 in dependencies. Code using graphql is refactored to use the new auth parameter for authentication. Jest config is updated to ignore transforming certain node_modules packages.

Changes

File(s) Change Summary
package.json Added @octokit/graphql@^8.2.2 to devDependencies, kept existing @octokit/graphql@^7.0.2 in dependencies.
netlify/functions/github_discussions.ts Refactored GraphQL call to use auth parameter for authentication instead of headers object.
netlify/functions/save-discussion-background/helpers.ts Simplified fetchGraphql to use auth parameter for authentication instead of custom headers.
jest.config.js Added transformIgnorePatterns to allow Jest to transform specific node_modules packages; fixed array formatting.

Sequence Diagram(s)

sequenceDiagram
    participant Handler as Lambda Handler
    participant Octokit as @octokit/graphql
    participant GitHub as GitHub API

    Handler->>Octokit: graphql(query, { auth: GITHUB_TOKEN })
    Octokit->>GitHub: Execute GraphQL query with token
    GitHub-->>Octokit: Return data
    Octokit-->>Handler: Return data
Loading

Assessment against linked issues

Objective Addressed Explanation
Update code to support @octokit/request v9 and @octokit/graphql v8 (#3690)

Poem

A hop and a skip, dependencies anew,
Octokit upgraded, requests running through!
Jest is now happy, the tests all align,
With tokens in place, our queries divine.
🐇✨ The code’s now refreshed—what a wonderful sign!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

npm warn config production Use --omit=dev instead.
npm warn EBADENGINE Unsupported engine {
npm warn EBADENGINE package: '@tisoap/react-flow-smart-edge@3.0.0',
npm warn EBADENGINE required: { node: '>=16', npm: '^8.0.0' },
npm warn EBADENGINE current: { node: 'v24.0.2', npm: '11.3.0' }
npm warn EBADENGINE }
npm error code ERR_SSL_WRONG_VERSION_NUMBER
npm error errno ERR_SSL_WRONG_VERSION_NUMBER
npm error request to https://10.0.0.28:4873/@parcel/watcher-wasm/-/watcher-wasm-2.4.1.tgz failed, reason: C03C18514A7F0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:354:
npm error
npm error A complete log of this run can be found in: /.npm/_logs/2025-05-25T17_36_49_002Z-debug-0.log


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2b0f918 and ebf7569.

📒 Files selected for processing (1)
  • jest.config.js (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • jest.config.js
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@netlify
Copy link

netlify bot commented Feb 17, 2025

Deploy Preview for asyncapi-website ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 8c6bf48
🔍 Latest deploy log https://app.netlify.com/projects/asyncapi-website/deploys/6839644b5c697c000885d831
😎 Deploy Preview https://deploy-preview-3697--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 project configuration.

@AritraDey-Dev AritraDey-Dev changed the title fix: Update code to support @octokit/request v9 and @octokit/graphql v8 fix: update code to support @octokit/request v9 and @octokit/graphql v8 Feb 17, 2025
@anshgoyalevil
Copy link
Member

anshgoyalevil commented Feb 23, 2025

@AritraDey-Dev Make sure all the tests and build pass

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (1)
scripts/dashboard/build-dashboard.js (1)

180-180: ⚠️ Potential issue

Update the module execution check for ES modules

The require.main === module check is specific to CommonJS and won't work in an ES module environment. This line needs to be updated to the ES module equivalent.

- if (require.main === module) {
+ if (import.meta.url === `file://${process.argv[1]}`) {
🧹 Nitpick comments (1)
scripts/dashboard/build-dashboard.js (1)

184-184: Successfully migrated to ES module exports

The export statement has been correctly migrated from CommonJS module.exports to ES module export.

For better readability, consider formatting the exports with each name on a separate line as suggested by the linter:

- export { getLabel, monthsSince, mapGoodFirstIssues, getHotDiscussions, getDiscussionByID, getDiscussions, writeToFile, start, processHotDiscussions, pause };
+ export {
+   getLabel,
+   monthsSince,
+   mapGoodFirstIssues,
+   getHotDiscussions,
+   getDiscussionByID,
+   getDiscussions,
+   writeToFile,
+   start,
+   processHotDiscussions,
+   pause
+ };
🧰 Tools
🪛 ESLint

[error] 184-184: Replace ·getLabel,·monthsSince,·mapGoodFirstIssues,·getHotDiscussions,·getDiscussionByID,·getDiscussions,·writeToFile,·start,·processHotDiscussions,·pause· with ⏎··getLabel,⏎··monthsSince,⏎··mapGoodFirstIssues,⏎··getHotDiscussions,⏎··getDiscussionByID,⏎··getDiscussions,⏎··writeToFile,⏎··start,⏎··processHotDiscussions,⏎··pause⏎

(prettier/prettier)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2cad54c and c7fea4e.

📒 Files selected for processing (1)
  • scripts/dashboard/build-dashboard.js (2 hunks)
🧰 Additional context used
🪛 ESLint
scripts/dashboard/build-dashboard.js

[error] 4-4: Unexpected use of file extension "js" for "./issue-queries.js"

(import/extensions)


[error] 184-184: Replace ·getLabel,·monthsSince,·mapGoodFirstIssues,·getHotDiscussions,·getDiscussionByID,·getDiscussions,·writeToFile,·start,·processHotDiscussions,·pause· with ⏎··getLabel,⏎··monthsSince,⏎··mapGoodFirstIssues,⏎··getHotDiscussions,⏎··getDiscussionByID,⏎··getDiscussions,⏎··writeToFile,⏎··start,⏎··processHotDiscussions,⏎··pause⏎

(prettier/prettier)

🔇 Additional comments (1)
scripts/dashboard/build-dashboard.js (1)

1-4: Successfully migrated to ES module imports

The imports have been properly migrated from CommonJS require statements to ES module import statements, which aligns with the PR objective to update Octokit dependencies.

Note: The ESLint warning about file extensions is a configuration issue. Including .js extensions in imports is actually required for ES modules in Node.js environments.

🧰 Tools
🪛 ESLint

[error] 4-4: Unexpected use of file extension "js" for "./issue-queries.js"

(import/extensions)

@nightknighto
Copy link
Contributor

nightknighto commented Mar 19, 2025

@AritraDey-Dev The testing workflow is failing. Are you still willing to continue on this?

@AritraDey-Dev
Copy link
Author

@AritraDey-Dev The testing workflow is failing. Are you still willing to continue on this?

Apologies for the delay. I will look into a possible fix. Do you have any insights on why the tests are failing?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c7fea4e and 892b3e0.

📒 Files selected for processing (4)
  • netlify/functions/github_discussions.ts (1 hunks)
  • netlify/functions/save-discussion-background/helpers.ts (1 hunks)
  • package.json (1 hunks)
  • tests/dashboard/build-dashboard.test.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • package.json
🧰 Additional context used
🧬 Code Definitions (1)
tests/dashboard/build-dashboard.test.js (5)
tests/casestudies/index.test.js (2) (2)
  • tempDir (7-7)
  • fs (1-1)
tests/markdown/check-markdown.test.js (2) (2)
  • tempDir (18-18)
  • fs (1-1)
tests/build-post-list.test.js (2) (2)
  • tempDir (7-7)
  • fs (1-1)
tests/build-tools.test.js (1) (1)
  • fs (3-3)
tests/readAndWriteJson.test.js (1) (1)
  • fs (1-1)
🪛 ESLint
tests/dashboard/build-dashboard.test.js

[error] 12-12: 'processHotDiscussions' is defined but never used.

(no-unused-vars)


[error] 13-13: 'pause' is defined but never used.

(no-unused-vars)


[error] 14-14: Unexpected use of file extension "js" for "./build-dashboard.js"

(import/extensions)

🔇 Additional comments (4)
netlify/functions/save-discussion-background/helpers.ts (1)

21-21: Authorization header updated to use Bearer token

The authorization scheme has been correctly updated from token to Bearer, which aligns with the OAuth 2.0 standard and is required for compatibility with the newer version of @octokit/graphql (v8.2.1).

This change ensures proper authentication with GitHub's GraphQL API v4, which prefers the Bearer token format.

tests/dashboard/build-dashboard.test.js (3)

37-38: File system operations updated to use promises API

The temporary directory creation has been properly updated to use the asynchronous fs.mkdir with the recursive option, which is more robust than the previous synchronous version.

This change aligns with modern JavaScript practices for handling file system operations using promises instead of callbacks or synchronous methods.


42-42: File system cleanup updated to use promises API

The temporary directory removal has been correctly updated to use the asynchronous fs.rm method with the recursive and force options, which is better than the previous synchronous version.

This change ensures proper cleanup after tests using modern promise-based file operations.


84-90: Test expectation updated for the rate limit warning

The test expectation for rate limit warnings has been updated to check for multiple arguments in the console.log call instead of a single string. This update is likely required due to changes in how logging happens in the updated version of the library.

The test now properly verifies each component of the rate limit warning message, which improves test specificity.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/dashboard/build-dashboard.test.js (1)

12-12: Add file extension to import path

According to ESLint rules and ES module best practices, the file extension should be included in the import path.

- } from './build-dashboard';// Adjust the import path as necessary
+ } from './build-dashboard.js';// Adjust the import path as necessary

Additionally, add a space before the comment for proper formatting:

- } from './build-dashboard';// Adjust the import path as necessary
+ } from './build-dashboard.js'; // Adjust the import path as necessary
🧰 Tools
🪛 ESLint

[error] 12-12: Missing file extension for "./build-dashboard"

(import/extensions)


[error] 12-12: Insert ·

(prettier/prettier)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 892b3e0 and 4b5c456.

📒 Files selected for processing (2)
  • netlify/functions/github_discussions.ts (1 hunks)
  • tests/dashboard/build-dashboard.test.js (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • netlify/functions/github_discussions.ts
🧰 Additional context used
🪛 ESLint
tests/dashboard/build-dashboard.test.js

[error] 12-12: Missing file extension for "./build-dashboard"

(import/extensions)


[error] 12-12: Insert ·

(prettier/prettier)

🔇 Additional comments (5)
tests/dashboard/build-dashboard.test.js (5)

1-3: LGTM: Proper ES module import syntax

The changes correctly update the import statements to use ES module syntax, which aligns with the PR's objective of updating Octokit dependencies to newer versions (v8 and v9) that likely require ES modules.


35-37: LGTM: Using Promise-based file system API

Good update to use the Promise-based fs.mkdir with the recursive: true option, which is more appropriate for async Jest test environments and aligns with modern JavaScript practices.


40-40: LGTM: Using Promise-based file system API for cleanup

Good update to use the Promise-based fs.rm with appropriate options for thorough cleanup after tests.


82-88: LGTM: Updated assertion for console.log format

The updated assertion correctly matches the new format of rate limit warning logs, which now uses multiple arguments instead of a single formatted string. This makes the test more specific and robust.


179-187:

Details

✅ Verification successful

Verify if processHotDiscussions import is needed

This test is checking functionality for processHotDiscussions, but this function isn't included in the imports at the top of the file. Previous review comments indicated it was unused, but this test suggests it might be needed.


🏁 Script executed:

#!/bin/bash
# Check if processHotDiscussions is used in build-dashboard.js and if it's exported

# First, check if the function exists in build-dashboard.js
echo "Checking if processHotDiscussions is defined in build-dashboard.js:"
rg -A 2 -B 2 "function\s+processHotDiscussions" ./scripts/dashboard/build-dashboard.js || rg -A 2 -B 2 "const\s+processHotDiscussions" ./scripts/dashboard/build-dashboard.js

# Then check if it's exported
echo "Checking if processHotDiscussions is exported:"
rg -A 2 -B 2 "export\s+.*processHotDiscussions" ./scripts/dashboard/build-dashboard.js

Length of output: 695


ProcessHotDiscussions is correctly integrated via getHotDiscussions

  • Verification confirms that processHotDiscussions is defined and exported in scripts/dashboard/build-dashboard.js.
  • The test in tests/dashboard/build-dashboard.test.js exercises the error handling for processHotDiscussions indirectly through getHotDiscussions, so a direct import isn’t required.

@codecov
Copy link

codecov bot commented May 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (ed22aa2) to head (8c6bf48).
⚠️ Report is 365 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #3697   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines          778       778           
  Branches       144       144           
=========================================
  Hits           778       778           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AritraDey-Dev
Copy link
Author

Thank you for reviewing this, @akshatnema.
I’ve reviewed the changes and couldn’t find anything that needs to be updated at the moment.
Please let me know if you notice anything that should be addressed.

@AritraDey-Dev AritraDey-Dev requested a review from akshatnema May 24, 2025 20:44
Comment on lines 13 to 15
transformIgnorePatterns: [
"/node_modules/(?!(@octokit|universal-user-agent|before-after-hook|@github|is-plain-object|@sindresorhus|deprecation)/)"
]
Copy link
Member

Choose a reason for hiding this comment

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

Why has this pattern been ignored in the jest config?

Copy link
Author

Choose a reason for hiding this comment

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

The pattern is used to ensure Jest transforms specific modern ES modules from node_modules (like @octokit) that would otherwise cause syntax errors due to untranspiled import/export statements.

Copy link
Author

Choose a reason for hiding this comment

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

Screenshot from 2025-05-25 14-37-34

The issue with the failing tests was due solely to the octokit module. After addressing it, the tests are now passing as expected.

@AritraDey-Dev AritraDey-Dev requested a review from akshatnema May 25, 2025 17:35
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json']
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
transformIgnorePatterns: [
'/node_modules/(?!((@[^/]+/[^/]+)|universal-user-agent|is-plain-object)/)',
Copy link
Author

Choose a reason for hiding this comment

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

@akshatnema I’ve updated the pattern to be more generalized for handling ESM packages in node_modules.
Would love to hear your feedback on this approach.

@sambhavgupta0705
Copy link
Member

@AritraDey-Dev please update the project

"typescript": "^5.3.3"
}
}
} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

add a line

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity 😴

It will be closed in 120 days if no further activity occurs. To unstale this pull request, add a comment with detailed explanation.

There can be many reasons why some specific pull request has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this pull request forward. Connect with us through one of many communication channels we established here.

Thank you for your patience ❤️

@anshgoyalevil
Copy link
Member

Thanks for the PR @AritraDey-Dev. Please re-open the PR with comments resolved if you are still working on the project.

@github-project-automation github-project-automation bot moved this from To Be Triaged to Done in Website - Kanban Feb 14, 2026
@SHUBHANSHU602
Copy link

@anshgoyalevil I have fixed it in , #5171 Please have a look.

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

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

fix: Update code to support @octokit/request v9 and @octokit/graphql v8

6 participants