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.

Probot receive errors with "TypeError: appFn is not a function"

See original GitHub issue

Bug Report

Current Behavior I’m testing locally with the node_modules/.bin/probot receive -e pull_request ... command.

I get an TypeError: appFn is not a function.

The reason might because I’ve set up my main function as follows (since this project deploys to serverless):

export function handler(app: Application) {
  app.on(['pull_request.opened'], async context => {...}
};

probot run npm start works just fine. This only happens when I call probot receive. Any tips here would be appreciated. Thank you!

Environment

  • Probot version(s): “version”: “10.9.0”
  • Node/npm version: “>= 12.18.2”
  • OS: OS 10.15.6

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gr2mcommented, Oct 1, 2020

Can you try to export the function as default?

export default function handler(app: any) {
  app.on(['pull_request.opened'], async context => {}
};
0reactions
losalexcommented, Sep 29, 2021

Just to provide a possible solution for people who encounter same issue - I was able to solve the problem by simply exporting default anonymous function, e.g.:

export = (app: Probot) => {
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

Refactoring probot event functions into seperate file causes ...
Refactoring probot event functions into seperate file causes error: TypeError: handler is not a function · Subscribe to RSS.
Read more >
Build your own Probot
We built Smee.io specifically for Probot, to receive webhook events ... This lets you focus on your app code, and not care what...
Read more >
Testing - Probot
It is frustrating to constantly create real GitHub events in order to test an app. Redelivering webhooks is possible and can be accessed...
Read more >
Android apps build failing - Build issue
TypeError : /tmp/596948-android-252041/src/entry/index.android.ts: isTSSatisfiesExpression is not a function at Object.
Read more >
Creating a Github Bot to Automatically Verify Snapshot ...
Github provides a framework to create apps in Node.js — Probot. ... If the bot did not publish a comment (there should be...
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