question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test failure TypeError on fresh create-probot-app from template checks-js with probot >8.0.0

See original GitHub issue

Bug Report

Current Behavior Upgrading probot to 8.0.2 or 9.0.0 on a fresh create-probot-app (started with probot 7.5.1 set as "^7.2.0"), based on the checks-js template results in a test failure.

- code/probot-bug » npx create-probot-app my-first-app
npx: installed 215 in 5.068s

Let's create a Probot app!
Hit enter to accept the suggestion.

? App name: my-first-app
? Description of app: A Probot app
? Author's full name: Greg Burek
? Author's email address: greg.burek@gmail.com
? Homepage:
? GitHub user or org name: gregburek
? Repository name: my-first-app
? Which template would you like to use? checks-js
[snip]
Finished scaffolding files!

Installing Node dependencies!
[snip]
- code/probot-bug » cd my-first-app
- probot-bug/my-first-app » npm run test

> my-first-app@1.0.0 test /Users/gburek/code/probot-bug/my-first-app
> jest && standard

  console.warn node_modules/before-after-hook/index.js:45
    [before-after-hook]: "Hook()" repurposing warning, use "Hook.Collection()". Read more: https://git.io/upgrade-before-after-hook-to-1.4

 PASS  test/index.test.js
  My Probot app
    ✓ creates a passing check (1061ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        3.545s
Ran all test suites.
- probot-bug/my-first-app » npm install probot@8
npm WARN deprecated probot@8.0.2: Update to Probot 9, both versios have been released at the same time by accedent. Sorry :(
npm WARN acorn-jsx@5.0.1 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.

+ probot@8.0.2
added 32 packages from 17 contributors, removed 7 packages, updated 3 packages and audited 479748 packages in 7.927s
found 0 vulnerabilities

- probot-bug/my-first-app » npm run test
 FAIL  test/index.test.js
  My Probot app
    ✕ creates a passing check (115ms)

  ● My Probot app › creates a passing check

    TypeError: this.app.getInstallationAccessToken is not a function

      at Application.<anonymous> (node_modules/probot/src/application.ts:496:46)
      at step (node_modules/probot/lib/application.js:40:23)
      at Object.next (node_modules/probot/lib/application.js:21:53)
      at node_modules/probot/lib/application.js:15:71
      at Object.<anonymous>.__awaiter (node_modules/probot/lib/application.js:11:12)
      at Object.auth (node_modules/probot/src/application.ts:495:15)
      at Promise.resolve.then (node_modules/@octokit/rest/plugins/authentication/before-request.js:50:20)

Expected behavior/code A passing test with latest probot lib

Environment

  • Probot version(s): v8.0.2 and v9.0.0
  • Node/npm version: v11.9.0/6.5.0
  • OS: OSX 10.13.6

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
kompirocommented, Apr 14, 2019

I mock getInstallationAccessToken like below.

probot = new Probot({})
// Load our app into probot
const app = probot.load(myProbotApp)
 
// just return a test token
app.app = {
  getInstallationAccessToken: (option) => Promise.resolve('test')
}
1reaction
gr2mcommented, Mar 17, 2019

We have to update the tests for the new Probot. We have to pass in a valid app id and private key. This is just for reference, I’ll see how to make this easier

- probot = new Probot({})
- // Load our app into probot
- const app = probot.load(myProbotApp)
- 
- // just return a test token
- app.app = () => 'test'
+ probot = new Probot({
+   id: 123,
+   cert: `-----BEGIN RSA PRIVATE KEY-----
+ MIICXQIBAAKBgQC2RTg7dNjQMwPzFwF0gXFRCcRHha4H24PeK7ey6Ij39ay1hy2o
+ H9NEZOxrmAb0bEBDuECImTsJdpgI6F3OwkJGsOkIH09xTk5tC4fkfY8N7LklK+uM
+ ndN4+VUXTPSj/U8lQtCd9JnnUL/wXDc46wRJ0AAKsQtUw5n4e44f+aYggwIDAQAB
+ AoGAW2/cJs+WWNPO3msjGrw5CYtZwPuJ830m6RSLYiAPXj0LuEEpIVdd18i9Zbht
+ fL61eoN7NEuSd0vcN1PCg4+mSRAb/LoauSO3HXote+6Lhg+y5mVYTNkE0ZAW1zUb
+ HOelQp9M6Ia/iQFIMykhrNLqMG9xQIdLH8BDGuqTE+Eh8jkCQQDyR6qfowD64H09
+ oYJI+QbsE7yDOnG68tG7g9h68Mp089YuQ43lktz0q3fhC7BhBuSnfkBHwMztABuA
+ Ow1+dP9FAkEAwJeYJYxJN9ron24IePDoZkL0T0faIWIX2htZH7kJODs14OP+YMVO
+ 1CPShdTIgFeVp/HlAY2Qqk/do2fzyueZJwJBAN5GvdUjmRyRpJVMfdkxDxa7rLHA
+ huL7L0wX1B5Gl5fgtVlQhPhgWvLl9V+0d6csyc6Y16R80AWHmbN1ehXQhPkCQGfF
+ RsV0gT8HRLAiqY4AwDfZe6n8HRw/rnpmoe7l1IHn5W/3aOjbZ04Gvzg9HouIpaqI
+ O8xKathZkCKrsEBz6aECQQCLgqOCJz4MGIVHP4vQHgYp8YNZ+RMSfJfZA9AyAsgP
+ Pc6zWtW2XuNIGHw9pDj7v1yDolm7feBXLg8/u9APwHDy
+ -----END RSA PRIVATE KEY-----`
+ })
+ 
+ // Load our app into probot
+ probot.load(myProbotApp)
Read more comments on GitHub >

github_iconTop Results From Across the Web

ProBot - Bot for Discord
A very customizable multipurpose bot for welcome image, In-depth logs, Social commands, Music, Moderation and many more ... Best Welcomer. Give your new...
Read more >
Developing an app - Probot
create-probot-app is the best way to start building a new app. It will generate a new app with everything you need to get...
Read more >
Discord ProBot - Complete Invite & Setup Guide - YouTube
Complete tutorial for using ProBot on Discord. Including how to invite it to your server, setup settings on the bot Dashboard, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found