Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Path must be a string" when combining apps #1671

Open
markjm opened this issue Apr 6, 2022 · 2 comments
Open

"Path must be a string" when combining apps #1671

markjm opened this issue Apr 6, 2022 · 2 comments

Comments

@markjm
Copy link

markjm commented Apr 6, 2022

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

const appFn = await resolveAppFunction(appPath);

or update docs to require inclusion of index.js

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

@welcome
Copy link

welcome bot commented Apr 6, 2022

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.

@joshbranham
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants