probot icon indicating copy to clipboard operation
probot copied to clipboard

"Path must be a string" when combining apps

Open markjm opened this issue 2 years ago • 2 comments

Bug Report

To reproduce:

  1. set up an empty/new probot app with the package.json set up as described here https://probot.github.io/docs/deployment/#combining-apps
  2. Run yarn start Current Behavior Error:
yarn start           
yarn run v1.22.18
$ probot run
/Users/../code/../node_modules/resolve/lib/sync.js:75
        throw new TypeError('Path must be a string.');
              ^

TypeError: Path must be a string.
    at resolveSync (/Users/../code/../node_modules/resolve/lib/sync.js:75:15)
    at Object.resolveAppFunction (/Users/../code/../node_modules/probot/lib/helpers/resolve-app-function.js:30:23)
    at combinedApps (/Users/../code/../node_modules/probot/lib/run.js:101:56)
    at async Server.load (/Users/../code/../node_modules/probot/lib/server/server.js:52:9)

Expected behavior/code Expect the app to start and work as expected.

Creating an empty index.js and running yarn start ./index.js works fine.

Environment

  • Probot version(s): 12.2.0
  • Node/npm version: v16/yarn v1

Possible Solution Guard the below line with existance check of appPath https://github.com/probot/probot/blob/420f88612dc517607bb240de031a242a8129e820/src/run.ts#L136

or update docs to require inclusion of index.js

Happy to send PR if consensus on problem & my proposed solution. Thanks!

markjm avatar Apr 06 '22 17:04 markjm

Thanks for opening this issue. A contributor should be by to give feedback soon. In the meantime, please check out the contributing guidelines and explore other ways you can get involved.

welcome[bot] avatar Apr 06 '22 17:04 welcome[bot]

I ran into this issue as well, in my case I am using the multi-app method to just have a shell around deploying the settings-app Probot.

I have an app.js like:

const settings = require("probot-settings");

module.exports = async (app, options) => {
  await settings(app, options);
};

And then to get things to work in NODE_ENV=production I had to use probot run ./app.js but in local environments probot run works.

joshbranham avatar Mar 17 '23 16:03 joshbranham