Ncc: `probot` errors

Created on 8 Oct 2019  Â·  11Comments  Â·  Source: vercel/ncc

:wave: I'm encountering an error when running a compiled project that has Probot as a dependency:

Details

ncc version: 0.20.5

Source:

const { Application } = require('probot')

Crashes with:

/Users/swinton/scratch/probot-app/dist/index.js:26154
        self.store = __ncc_wildcard$0(storeName).create(args);
                                                ^

TypeError: Cannot read property 'create' of undefined
    at Object.caching (/Users/swinton/scratch/probot-app/dist/index.js:26154:49)
    at Object.createDefaultCache (/Users/swinton/scratch/probot-app/dist/index.js:15375:36)
    at Object.module.exports.module.exports (/Users/swinton/scratch/probot-app/dist/index.js:51797:21)
    at __webpack_require__ (/Users/swinton/scratch/probot-app/dist/index.js:22:30)
    at Object.<anonymous> (/Users/swinton/scratch/probot-app/dist/index.js:8599:1)
    at __webpack_require__ (/Users/swinton/scratch/probot-app/dist/index.js:22:30)
    at startup (/Users/swinton/scratch/probot-app/dist/index.js:37:19)
    at /Users/swinton/scratch/probot-app/dist/index.js:43:18
    at Object.<anonymous> (/Users/swinton/scratch/probot-app/dist/index.js:46:10)
    at Module._compile (internal/modules/cjs/loader.js:701:30)

Package.json:

{
  "name": "probot-app",
  "version": "0.0.1",
  "description": "",
  "main": "index.js",
  "scripts": {
    "build": "ncc build ./index.js"
  },
  "license": "ISC",
  "dependencies": {
    "probot": "^9.5.1"
  },
  "devDependencies": {
    "@zeit/ncc": "^0.20.5"
  }
}

Most helpful comment

Thanks for figuring this one out, @imjohnbo. Seems like this is good to close? 🎉


It's now fixed for me (complied Probot app as GH action) :-)

✨ Great to hear! In case it helps, there’s also https://github.com/probot/actions-adapter which will convert a Probot app into an Action.

All 11 comments

@swinton, what version of Node are you running? I wasn't able to reproduce this with Node 11.11.0 at https://github.com/imjohnbo/probot-playground. 👀

what version of Node are you running?

11.11.0 also...

I wasn't able to reproduce this with Node 11.11.0 at https://github.com/imjohnbo/probot-playground.

Strange. I cloned your repo and i’m still getting the error above with the compiled artifact from ncc 🤔

Strange indeed! Check out these successful build results from a GitHub Actions runner.

I'm interested in what is causing a local failure for you.

Strange indeed! Check out these successful build results from a GitHub Actions runner.

I'm interested in what is causing a local failure for you.

Thanks @imjohnbo.

I forked your repo and edited the build.yml to actually run the file generated by ncc, when Actions runs the file, the same error as above is reported:

TypeError: Cannot read property 'create' of undefined
    at Object.caching (/home/runner/work/probot-playground/probot-playground/dist/index.js:26159:49)
    at Object.createDefaultCache (/home/runner/work/probot-playground/probot-playground/dist/index.js:15376:36)
    at Object.module.exports.module.exports (/home/runner/work/probot-playground/probot-playground/dist/index.js:51793:21)
    at __webpack_require__ (/home/runner/work/probot-playground/probot-playground/dist/index.js:22:30)
    at Object.<anonymous> (/home/runner/work/probot-playground/probot-playground/dist/index.js:8599:25)
    at __webpack_require__ (/home/runner/work/probot-playground/probot-playground/dist/index.js:22:30)
    at startup (/home/runner/work/probot-playground/probot-playground/dist/index.js:37:19)
    at /home/runner/work/probot-playground/probot-playground/dist/index.js:43:18
    at Object.<anonymous> (/home/runner/work/probot-playground/probot-playground/dist/index.js:46:10)
    at Module._compile (internal/modules/cjs/loader.js:778:30)

I'm also affected by this.

Any update on this? I'm also facing this issue

@imjohnbo did some more research and was able to isolate this issue to cache-manager:

Source:

var cacheManager = require('cache-manager');
var memoryCache = cacheManager.caching({store: 'memory', max: 100, ttl: 10/*seconds*/});
var ttl = 5;

Would you all mind testing against this Probot sha in addition to what I have done here? Release should be cut soon. Fingers crossed that that fixes it!

Probot 9.6.5 was released today, including this commit, @swinton! This seems to fix the crash you reported above. 🎉

It's now fixed for me (complied Probot app as GH action) :-)

Thanks for figuring this one out, @imjohnbo. Seems like this is good to close? 🎉


It's now fixed for me (complied Probot app as GH action) :-)

✨ Great to hear! In case it helps, there’s also https://github.com/probot/actions-adapter which will convert a Probot app into an Action.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rauchg picture rauchg  Â·  3Comments

j picture j  Â·  3Comments

guybedford picture guybedford  Â·  4Comments

coetry picture coetry  Â·  5Comments

maku picture maku  Â·  3Comments