Code Monkey home page Code Monkey logo

app.js's People

Contributors

anton-rudeshko avatar baoshan avatar chrisrowe avatar dependabot[bot] avatar gr2m avatar greenkeeper[bot] avatar hiimbex avatar jackycute avatar jamesmgreene avatar jbjonesjr avatar jovel avatar jstastny avatar k2snowman69 avatar kfcampbell avatar laughedelic avatar mfix22 avatar michaelbeaumont avatar mosattler avatar ng-galien avatar nickfloyd avatar noclat avatar octokitbot avatar oscard0m avatar renovate[bot] avatar tmadeira avatar williamdes avatar wolfy1339 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

app.js's Issues

An in-range update of mocha is breaking the build 🚨

The devDependency mocha was updated from 6.0.2 to 6.1.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… coverage/coveralls: First build on greenkeeper/mocha-6.1.0 at 100.0% (Details).
  • ❌ Travis CI - Branch: The build failed.

Release Notes for v6.1.0

6.1.0 / 2019-04-07

πŸ”’ Security Fixes

  • #3845: Update dependency "js-yaml" to v3.13.0 per npm security advisory (@plroebuck)

πŸŽ‰ Enhancements

  • #3766: Make reporter constructor support optional options parameter (@plroebuck)
  • #3760: Add support for config files with .jsonc extension (@sstephant)

πŸ“  Deprecations

These are soft-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:

πŸ› Fixes

  • #3829: Use cwd-relative pathname to load config file (@plroebuck)
  • #3745: Fix async calls of this.skip() in "before each" hooks (@juergba)
  • #3669: Enable --allow-uncaught for uncaught exceptions thrown inside hooks (@givanse)

and some regressions:

πŸ“– Documentation

πŸ”© Other

  • #3830: Replace dependency "findup-sync" with "find-up" for faster startup (@cspotcode)
  • #3799: Update devDependencies to fix many npm vulnerabilities (@XhmikosR)
Commits

The new version differs by 28 commits.

  • f4fc95a Release v6.1.0
  • bd29dbd update CHANGELOG for v6.1.0 [ci skip]
  • aaf2b72 Use cwd-relative pathname to load config file (#3829)
  • b079d24 upgrade deps as per npm audit fix; closes #3854
  • e87c689 Deprecate this.skip() for "after all" hooks (#3719)
  • 81cfa90 Copy Suite property "root" when cloning; closes #3847 (#3848)
  • 8aa2fc4 Fix issue 3714, hide pound icon showing on hover header on docs page (#3850)
  • 586bf78 Update JS-YAML to address security issue (#3845)
  • d1024a3 Update doc examples "tests.html" (#3811)
  • 1d570e0 Delete "/docs/example/chai.js"
  • ade8b90 runner.js: "self.test" undefined in Browser (#3835)
  • 0098147 Replace findup-sync with find-up for faster startup (#3830)
  • d5ba121 Remove "package" flag from sample config file because it can only be passes as CLI arg (#3793)
  • a3089ad update package-lock
  • 75430ec Upgrade yargs-parser dependency to avoid loading 2 copies of yargs

There are 28 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Dependency Dashboard

This issue contains a list of Renovate updates and their statuses.

Awaiting Schedule

These updates are awaiting their schedule. Click on a checkbox to ignore the schedule.

  • fix(deps): lock file maintenance

  • Check this box to trigger a request for Renovate to run again on this repository

Needs TypeScript definitions

I use this package in my programs and would love some TypeScript definitions for this package.
Since all the other packages seem to have some (mostly), I wanted to suggest to add them here.

An in-range update of ts-jest is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency ts-jest was updated from 25.2.1 to 25.3.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

ts-jest is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… test (12): There are 1 failures, 0 warnings, and 0 notices.
  • βœ… test (10): There are 1 failures, 0 warnings, and 0 notices.
  • ❌ test (8): There are 1 failures, 0 warnings, and 0 notices.

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Build error: Type '(BaseWebhookEvent<"push"> | BaseWebhookEvent<"public"> | BaseWebhookEvent<"label"> | BaseWebhookEvent<"meta"> | ... 199 more ... | (BaseWebhookEvent<...> & { ...; })) & { ...; }' does not satisfy the constraint 'Options<unknown>'.

This is a follow up to #201 @G-Rath @oscard0m @wolfy1339

I get the following error since yesterdays lock file update which bumped @octokit/webhooks from 8.4.1 to 8.5.3 and @octokit/webhooks-definitions to 3.61.0 to 3.62.5

Any idea what it could be?

error TS2344: Type '(BaseWebhookEvent<"push"> | BaseWebhookEvent<"public"> | BaseWebhookEvent<"label"> | BaseWebhookEvent<"meta"> | ... 199 more ... | (BaseWebhookEvent<...> & { ...; })) & { ...; }' does not satisfy the constraint 'Options<unknown>'.
  Type 'BaseWebhookEvent<"push"> & { octokit: Octokit; }' has no properties in common with type 'Options<unknown>'.

13 ): Webhooks<EmitterWebhookEvent & { octokit: Octokit }> {
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/webhooks.ts:14:3 - error TS2322: Type 'Webhooks<{ secret: string; path: string; transform: (event: BaseWebhookEvent<"push"> | BaseWebhookEvent<"public"> | BaseWebhookEvent<"label"> | ... 200 more ... | (BaseWebhookEvent<...> & { ...; })) => Promise<...>; }>' is not assignable to type 'Webhooks<(BaseWebhookEvent<"push"> | BaseWebhookEvent<"public"> | BaseWebhookEvent<"label"> | BaseWebhookEvent<"meta"> | ... 199 more ... | (BaseWebhookEvent<...> & { ...; })) & { ...; }>'.
  Type '{ secret: string; path: string; transform: (event: BaseWebhookEvent<"push"> | BaseWebhookEvent<"public"> | BaseWebhookEvent<"label"> | ... 200 more ... | (BaseWebhookEvent<...> & { ...; })) => Promise<...>; }' is not assignable to type '(BaseWebhookEvent<"push"> | BaseWebhookEvent<"public"> | BaseWebhookEvent<"label"> | BaseWebhookEvent<"meta"> | ... 199 more ... | (BaseWebhookEvent<...> & { ...; })) & { ...; }'.
    Type '{ secret: string; path: string; transform: (event: BaseWebhookEvent<"push"> | BaseWebhookEvent<"public"> | BaseWebhookEvent<"label"> | ... 200 more ... | (BaseWebhookEvent<...> & { ...; })) => Promise<...>; }' is not assignable to type 'BaseWebhookEvent<"workflow_run"> & { payload: { action: "requested"; }; } & { octokit: Octokit; }'.
      Type '{ secret: string; path: string; transform: (event: BaseWebhookEvent<"push"> | BaseWebhookEvent<"public"> | BaseWebhookEvent<"label"> | ... 200 more ... | (BaseWebhookEvent<...> & { ...; })) => Promise<...>; }' is missing the following properties from type 'BaseWebhookEvent<"workflow_run">': id, name, payload

 14   return new Webhooks({
      ~~~~~~~~~~~~~~~~~~~~~
 15     secret: options.secret,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~
... 
 57     },
    ~~~~~~
 58   });
    ~~~~~

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: package.json
Error type: The renovate configuration file contains some invalid settings
Message: Configuration option 'packageRules[0].npm' should be a json object, Invalid configuration option: @pika/pack, Invalid configuration option: author, Invalid configuration option: jest, Invalid configuration option: license, Invalid configuration option: main, Invalid configuration option: name, Invalid configuration option: packageRules[0].@octokit/auth-app, Invalid configuration option: packageRules[0].@octokit/auth-unauthenticated, Invalid configuration option: packageRules[0].@octokit/core, Invalid configuration option: packageRules[0].@octokit/oauth-app, Invalid configuration option: packageRules[0].@octokit/plugin-paginate-rest, Invalid configuration option: packageRules[0].@octokit/types, Invalid configuration option: packageRules[0].@octokit/webhooks, Invalid configuration option: packageRules[0].i, Invalid configuration option: packageRules[1].@pika/pack, Invalid configuration option: packageRules[1].@pika/plugin-build-node, Invalid configuration option: packageRules[1].@pika/plugin-ts-standard-pkg, Invalid configuration option: packageRules[1].@types/jest, Invalid configuration option: packageRules[1].@types/node, Invalid configuration option: packageRules[1].@types/node-fetch, Invalid configuration option: packageRules[1].fetch-mock, Invalid configuration option: packageRules[1].jest, Invalid configuration option: packageRules[1].mockdate, Invalid configuration option: packageRules[1].node-fetch, Invalid configuration option: packageRules[1].prettier, Invalid configuration option: packageRules[1].semantic-release, Invalid configuration option: packageRules[1].semantic-release-plugin-update-version-in-files, Invalid configuration option: packageRules[1].ts-jest, Invalid configuration option: packageRules[1].typescript, Invalid configuration option: publishConfig, Invalid configuration option: release, Invalid configuration option: renovate, Invalid configuration option: scripts, Invalid configuration option: version, The "npm" object can only be configured at the top level of a config but was found inside "packageRules[0]"

getSignedJsonWebToken() yields error:0906D06C:PEM routines:PEM_read_bio:no start line

Passing a PEM private key (in double quotes with line breaks replaced with \n, as shown in docs) to app.getSignedJsonWebToken() yields "error:0906D06C:PEM routines:PEM_read_bio:no start line". I'm using the function in a node lambda with a simple configuration:

const APP_ID = process.env.GITHUB_APP_ID;
const PRIVATE_KEY = process.env.GITHUB_PRIVATE_KEY;

const app = new App({ id: APP_ID, privateKey: PRIVATE_KEY });
const jwt = app.getSignedJsonWebToken();

As a note, logging the app ID and private key does show them both being brought in correctly.

TypeScript build error: Return type of exported function has or is using name 'BaseWebhookEvent' from external module "/Users/gregor/Projects/octokit/app.js/node_modules/@octokit/webhooks/dist-types/types" but cannot be named.

Occurred here after upgrading to @octokit/webhooks v8:
https://github.com/octokit/app.js/runs/1858152718?check_suite_focus=true#step:5:14

node_modules/typescript/bin/tsc --outDir pkg/dist-src/ -d --declarationDir pkg/dist-types/ --project tsconfig.json --target es2020 --module esnext --noEmit false --sourceMap false
src/webhooks.ts:8:17 - error TS4058: Return type of exported function has or is using name 'BaseWebhookEvent' from external module "node_modules/@octokit/webhooks/dist-types/types" but cannot be named.

8 export function webhooks(
                  ~~~~~~~~

@G-Rath @wolfy1339 @oscard0m does that error ring a bell?

An in-range update of @octokit/request is breaking the build 🚨

The dependency @octokit/request was updated from 5.0.0 to 5.0.1.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@octokit/request is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details

Release Notes for v5.0.1

5.0.1 (2019-07-12)

Bug Fixes

  • package: update universal-user-agent to version 3.0.0 (174e474)
FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

The automated release is failing 🚨

🚨 The automated release from the 12.x branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can fix this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the 12.x branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here are some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


The release 12.0.7 on branch 12.x cannot be published as it is out of range.

Based on the releases published on other branches, only versions within the range >=12.0.6 <12.0.6 can be published from branch 12.x.

The following commits are responsible for the invalid release:

  • fix(deps): revert update dependency @octokit/webhooks to v10 (#297) (1da972d)
  • chore(deps): update jest monorepo to v28 (major) (#288) (65ded90)

Those commits should be moved to a valid branch with git merge or git cherry-pick and removed from branch 12.x with git revert or git reset.

A valid branch could be master.

See the workflow configuration documentation for more details.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

{"error":"Required headers missing: x-hub-signature-256"}

We are using GitHub 2.22 which does not seem to send x-hub-signature-256 in the webhook header, only x-hub-signature.
This is causing an {"error":"Required headers missing: x-hub-signature-256"} when using the @octokit/app module.
Is there a way to tell the Octokit to use x-hub-signature instead of x-hub-signature-256 ?

How i use app.getInstallationOctokit() ???

I want to use the function, but always return an error...

`:\workspace\Accentio Devops\node_modules@octokit\auth-app\dist-node\index.js:201
throw new Error("[@octokit/auth-app] installationId option is required for installation authentication.");
^

Error: [@octokit/auth-app] installationId option is required for installation authentication.
at getInstallationAuthentication (C:\workspace\Accentio Devops\node_modules@octokit\auth-app\dist-node\index.js:201:11) at auth (C:\workspace\Accentio Devops\node_modules@octokit\auth-app\dist-node\index.js:336:12)
at getInstallationOctokit (C:\workspace\Accentio Devops\node_modules@octokit\app\dist-node\index.js:217:22)
at AuthController.getInstallationClientByInstallationId (C:\workspace\Accentio Devops\src\authentication\AuthController.js:115:40)
at processTicksAndRejections (node:internal/process/task_queues:93:5)
at async C:\workspace\Accentio Devops\src\main.js:15:20
npm ERR! code 1
npm ERR! path C:\workspace\Accentio Devops
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node src/main.js`

How i use this command?, the documentation is null.....
Im using in this way... like the documentation page:

const { octokit } = await this.app.getInstallationOctokit(installationAccessToken.token);

An in-range update of prettier is breaking the build 🚨

The devDependency prettier was updated from 1.17.1 to 1.18.0.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details

Release Notes for 1.18.0

πŸ”— Release Notes

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Add documentation on how to migrate to @octokit/auth-app

This library is being deprecated in favor of https://github.com/octokit/auth-app.js/. The @octokit/app package will likely be repurposed in future.

My migration plan is as follows:

  1. Release a new breaking version. Create a 5.x branch and make it the default branch. Remove all code. Make the default export log a deprecation message, linking to the new README.md in the 5.x branch. The new README.md will explain that the package was deprecated in favor of @octokit/auth-app and how to migrate from one to the other.
  2. Deprecate the previous versions on npm, with a link to the migration documentation

If repurposed in future, make the next release version 10

How do I use `createNodeMiddleware` in Deno

When I try to use this function I get the following error:

TypeError: t.writeHead is not a function
    at Object.T [as onUnhandledRequest] (https://esm.sh/v95/@octokit/[email protected]/deno/app.js:2:3458)
    at G (https://esm.sh/v95/@octokit/[email protected]/deno/app.js:2:4308)
    at Server.#respond (https://deno.land/[email protected]/http/server.ts:298:37)
    at Server.#serveHttp (https://deno.land/[email protected]/http/server.ts:340:20)

I'm assuming this function is Node only so I tried to implement a basic receiver that I could use to receive events but it errors too:

await serve(async (req) => {
  const body = await req.text();

  await app.webhooks.verifyAndReceive({
    id: req.headers.get("x-github-delivery") ?? "",
    name: req.headers.get(
      "x-github-event",
    ) as EmitterWebhookEventWithStringPayloadAndSignature["name"] ?? "",
    signature: req.headers.get("x-hub-signature-256") ?? "",
    payload: body,
  });

  return new Response("ok");
}, { port: 3000 });
TypeError: Cannot read properties of null (reading 'map')
    at o (https://esm.sh/v95/@octokit/[email protected]/deno/webhooks-methods.js:2:256)
    at y (https://esm.sh/v95/@octokit/[email protected]/deno/webhooks-methods.js:2:195)
    at async x (https://esm.sh/v95/@octokit/[email protected]/deno/webhooks.js:2:8000)
    at async Server.serve.port (file:///home/xenfo/projects/maintainer/src/index.ts:48:3)
    at async Server.#respond (https://deno.land/[email protected]/http/server.ts:298:18)

So how would I create the server?

An in-range update of @octokit/request is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The dependency @octokit/request was updated from 5.3.3 to 5.3.4.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

@octokit/request is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.

Status Details
  • ❌ test (12): There are 2 failures, 0 warnings, and 0 notices.
  • βœ… test (10): There are 1 failures, 0 warnings, and 0 notices.
  • ❌ test (8): There are 1 failures, 0 warnings, and 0 notices.

Release Notes for v5.3.4

5.3.4 (2020-03-24)

Bug Fixes

  • package: update @octokit/request-error to version 2.0.0 (c5a04e8)
FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Improving API use efficiency for large apps

Background:

  • I want my app to "resync" its list of installations + repositories hourly, in case it missed or mishandled any installation webhooks
  • The app has 10k+ installations, hundreds of thousands of repos, so this takes up a LOT of time and API requests

I'm wondering if there are any existing ways to perform such a "sync" more efficiently - whether exposed currently through this library or not.

Is there any retry functionality?

I'm curious if there's any retry functionality available as there is for the rest.js API. Retry is necessary due to network instability with github.

[DOCS]: How to `@octokit/graphql`?

Describe the need

How can I get this to work with @octokit/graphql

https://www.npmjs.com/package/@octokit/graphql#authentication

import { Octokit } from "@octokit/rest";
import { graphql } from "@octokit/graphql";
import { App } from "@octokit/app";

const octokit = async () => {
  const app = new App({
    appId: process.env.GITHUB_APP_ID ?? "",
    privateKey: process.env.GITHUB_PRIVATE_KEY ?? "",
    oauth: {
      clientId: process.env.GITHUB_CLIENT_ID ?? "",
      clientSecret: process.env.GITHUB_CLIENT_SECRET ?? "",
    },
    Octokit,
  });
  let installationId = 123;

  for await (const { installation } of app.eachInstallation.iterator()) {
    installationId = installation.id;
  }

  const octokit = await app.getInstallationOctokit(installationId);

  const graphqlWithAuth = graphql.defaults({
    request: {
      hook: octokit.hook,
    },
  });

  return {
    ...octokit,
    graphql: graphqlWithAuth,
  };
};

Error I'm receiving: error - Error: method for before hook must be a function

Which I believe is coming from this webhook line

The reason I'm looking for octokit.hook is because the @octokit/graphql docs show a hook as the way to auth.

const { createAppAuth } = require("@octokit/auth-app");
const auth = createAppAuth({
  appId: process.env.APP_ID,
  privateKey: process.env.PRIVATE_KEY,
  installationId: 123,
});
const graphqlWithAuth = graphql.defaults({
  request: {
    hook: auth.hook,
  },
});

I believe that I'm going to need to load in @octokit/auth-app as well to be able to graphql auth. I just want to make sure that's what is expected.

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

[FEAT]: Docs?

Describe the need

Are there any docs for this library? Having trouble locating them, I see a bunch of octokit stuff but not for this app package.

SDK Version

No response

API Version

No response

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

An in-range update of prettier is breaking the build 🚨


☝️ Important announcement: Greenkeeper will be saying goodbye πŸ‘‹ and passing the torch to Snyk on June 3rd, 2020! Find out how to migrate to Snyk and more at greenkeeper.io


The devDependency prettier was updated from 2.0.1 to 2.0.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

prettier is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • βœ… update_prettier: There are 0 failures, 1 warnings, and 0 notices.
  • βœ… test (12): There are 1 failures, 0 warnings, and 0 notices.
  • ❌ test (10): There are 2 failures, 0 warnings, and 0 notices.
  • ❌ test (8): There are 1 failures, 0 warnings, and 0 notices.

Release Notes for 2.0.2

πŸ”— Changelog

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Derive `octokit` type from `Octokit` option

const { Octokit } = require("@octokit/rest")

const app = new App({
  appId: 123,
  privateKey: "-----BEGIN PRIVATE KEY-----\n...",
  Octokit
});
app.octokit.issues.create // should get TypeScript IntelliSense

Error: [@octokit/webhooks] signature does not match event payload and secret

I'm unable to use octokit/app.js because the "breaking" change is only a minor version bump (9.8.0 to 9.8.1) and is "compatible".
octokit/webhooks.js#593

Code
const { App, createNodeMiddleware } = require('@octokit/app');

const app = new App({
    appId: "122298",
    webhooks: { secret: process.env.webhookssecret },
    oauth: {
        clientId: process.env.clientId,
        clientSecret: process.env.clientSecret,
    },
    privateKey: process.env.privateKey,
});

app.webhooks.onError(e => {
    console.error("Webhook failed");
    console.error(e.event);
})

require("http").createServer(createNodeMiddleware(app)).listen(process.env.PORT);
Error
Webhook failed
Error: [@octokit/webhooks] signature does not match event payload and secret
    at verifyAndReceive (C:\Users\denro\sources\ConflictResolver\node_modules\@octokit\app\node_modules\@octokit\webhodules\@octokit\webhooks\dist-node\index.js:259:19)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async middleware (C:\Users\denro\sources\ConflictResolver\node_modules\@octokit\app\node_modules\@octokit\webhodules\@octokit\webhooks\dist-node\index.js:344:5) {
  event: {
    id: 'b7479b30-d1f8-11eb-94a6-6aa61ee800f9',
    name: 'issue_comment',
    payload: {
      action: 'created',
      issue: [Object],
      comment: [Object],
      repository: [Object],
      sender: [Object],
      installation: [Object]
    },
    signature: 'sha256=6df88c02f8ba3dcc667f1bbcd980ecd4a4ae9f6611efc115df58a8fcffbbacce'
  },
  status: 400
}

Customizable cache time for expiring tokens

I noticed that the default LRU expiry is after 59 minutes. I'm sure there's plenty of apps who need a token with more than 1 minute validity, and a token expiring mid-way through an app's job is pretty confusing to debug, so it would be nice if the cache ttl could be configurable without needing to substitute an entirely new cache.

app.eachRepository does not support installation ID argument

According to README, users can optionally pass installation ID to iterate through all repositories in one installation to app.eachRepository:

for await (const { octokit, repository } of app.eachRepository.iterator({ installationId })) { /* ... */ }
await app.eachRepository({ installationId }, ({ octokit, repository }) => /* ... */)

That seems to be important -- to avoid fetching all repositories of all installations when you only want to iterate through repositories of a specific installation --, but it does not seem to be implemented (https://github.com/octokit/app.js/blob/master/src/each-repository.ts).

[Support] How to use `app.octokit.request()`?

I'm having an issue when requesting an endpoint using app.octokit.request(), how do I fix this?

Example code (typescript):

import { config } from 'dotenv';
import { App } from '@octokit/app';
import { readFileSync } from 'fs';

config();

const app = new App({
  appId: process.env.APP_ID ?? '',
  privateKey: readFileSync('./private_key.pem').toString(),
});

app.octokit.request('GET /repos/{owner}/{repo}/commits', {
  owner: 'microsoft',
  repo: 'vscode',
}).catch(err => {
  if (err instanceof Error) {
    console.error(err.stack);
  }
});

Output:

Error: [@octokit/auth-app] installationId option is required for installation authentication.
    at getInstallationAuthentication (node_modules/@octokit/auth-app/dist-node/index.js:213:11)
    at hook (node_modules/@octokit/auth-app/dist-node/index.js:437:13)
    at node_modules/before-after-hook/lib/register.js:25:15

Deprecate getNodeMiddleware in favor of createNodeMiddleware

What’s missing?

import { createNodeMiddleware } from "@octokit/app"

Why?

We currently have an inconsistent naming for a method that exports a http middleware that is compatible with Node's built in http server as well as express. @octokit/app currently exports getNodeMiddleware, but in other modules and in @probot we use the name createNodeMiddleware.

How

Start by creating /test/deprecations.test.ts, similar to probot's deprecation tests in v10. The test should import getNodeMiddleware and use it, then verify that a deprecation message was logged.

You can start a pull request draft at this point.

Then update the existing tests to import createNodeMiddleware instead of getNodeMiddleware.

Finally implement the deprecation log when calling getNodeMiddleware and the new createNodeMiddleware export

Migration guide to v10?

I have an app which uses getInstallationAccessToken(), and that function is not available anymore in the new version v10. I would appreciate a migration guide which explains how to migrate my code.

Error when compiling 2.2.1 with typescript 2.8.3

node_modules/@octokit/app/index.d.ts(1,22): error TS7016: Could not find a declaration file for module 'lru-cache'. 'C:/code/functions/node_modules/lru-cache/index.js' implicitly has an 'any' type.
Try npm install @types/lru-cache if it exists or add a new declaration (.d.ts) file containing declare module 'lru-cache';

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Cannot push to the Git repository.

semantic-release cannot push the version tag to the branch master on the remote Git repository with URL https://x-access-token:[secure]@github.com/octokit/app.js.

This can be caused by:


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

`App.defaults()`

What’s missing?

Compare https://github.com/octokit/oauth-app.js#oauthappdefaultsoptions and https://github.com/octokit/core.js#defaults

const MyApp = App.defaults({
  /* set default constructor options */
})

Why?

Needed for the octokit module, see octokit/octokit.js#15. The Octokit constructor needs to be set to Octokit exported by the octokit module, which includes several plugins.

Alternatives you tried

I could implement the defaults functionality within octokit but there it's the same amount of work, and App.defaults() will be useful outside of octokit

broken node 10/12 compatibility

heya, we are using octokit for our cicd. It relies on an older version of node and upgrading node would require us to fork upstream projects.

It looks like between 12.0.5 and 12.0.6 in these commits https://github.com/octokit/webhooks.js/pull/555/files and octokit/webhooks.js@e887f05 , node support was removed for 10/12 in the webhooks library. This is cool and exciting! It also has taken down our CI platform's ability to run CI builds at all by breaking the upstream proj's use of octokit. Our CI platform shells out to yarn add to grab dependencies for CI glue code.

Would it be possible to push a patch version that is compatible with node 10/12? Then make a major release that discontinues support for node 10/12?

We tried to do some npm/yarn resolutions stuff https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/ but are stuck on an old yarn version too. We are definitely doing our best to prioritize this stuff but it is an old wide reaching CI system(we're actively migrating projects to a new CI system but have some ways to go).

thank you! let me know if you need any more information

GHE support

Hi there!

Thanks for the awesome library here.

Currently I'm struggling with using it as a base for our Node.JS internal GHE Apps. Got an error Integration must generate a public key. I found a relevant octokit/octokit.rb#1080.

But for now base url seems hardcoded to https://api.github.com through @octokit/request and I can't see a way it can be overwritten from app.js instance.

Am I missing something?

Do you have any plans to support GHE endpoints?

Or would you accept a PR for this behaviour?

Thanks!

Question on general flow for apps

Hi, Octokit is great. That first.

Just a short question on general flow for SaaS apps that integrate Github Apps. I'm building https://checklyhq.com and have a use case for users installing my Github App and my SaaS taking action on certain webhooks.

  1. User installs app. This I have figured out. I redirect the user to the Github hosted install page and get a callback on a URL.

  2. The URL contains the installation_id of the app. This is important. I save this in the user's profile in my database.

  3. Some time later, or directly after, the user navigates in my SaaS app and needs to select a repo in his/her account he/she wants to use as a trigger for actions in my SaaS.

For this, I need to list the user's repos. I can do this with octokit.repos.listForUser() but I need the username for this to work. I don't have that.

Do I need to explicitly fetch the username / owner associated with the installation_id or is there some quick other way I have missed?

P.S. I can do this, I can fetch all data using JWT and InstallationID tokens. Works all fine. Just seems a lot of work...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.