github / github-app-js-sample

Sample of a GitHub App that comments new pull requests
MIT License
102 stars 141 forks source link

fix fetch setup issue #36

Closed msu-copilot closed 6 months ago

msu-copilot commented 6 months ago

When I run npm run server, I encountered the error below. I want to fix this by installing a fetch library and have the app to use it.

====== npm run server

starter_github_app@0.0.1 server node app.js

/Users/msu/github-app-js-sample/node_modules/@octokit/request/dist-node/index.js:69 throw new Error( ^

Error: fetch is not set. Please pass a fetch implementation as new Octokit({ request: { fetch }}). Learn more at https://github.com/octokit/octokit.js/#fetch-missing at fetchWrapper (/Users/msu/github-app-js-sample/node_modules/@octokit/request/dist-node/index.js:69:11) at request2 (/Users/msu/github-app-js-sample/node_modules/@octokit/request/dist-node/index.js:192:14) at hook (/Users/msu/github-app-js-sample/node_modules/@octokit/auth-app/dist-node/index.js:364:24) at async requestWithGraphqlErrorHandling (/Users/msu/github-app-js-sample/node_modules/@octokit/plugin-retry/dist-node/index.js:71:20) at async Job.doExecute (/Users/msu/github-app-js-sample/node_modules/bottleneck/light.js:405:18)

======

msu-copilot commented 6 months ago

Hi @carturoch , thank you for your response. I discovered the issue was due to the outdated Node version I was using. The problem was resolved after I upgraded from v16 to v20. Therefore, in this PR, I've only updated the Node version in the Readme.