generateTargetUrl() fails to generate an URL

Hello ,
I am trying to create GitHub a webhook via the API Call.
However the generateTargetUrl
() itself is failing .The API Call itself is not triggering .The following is the code piece in the Server.js

    onInstallHandler: function (args) {
  generateTargetUrl().done(function (targetUrl) 
    let URL=''+client.iparams.get("username")+'/'+client.iparams.get("reponame")+'/hooks';
    $, {
        headers: {
          Authorization: 'token '+client.iparams.get("client_key"),
        isOAuth: true,
        json: {
          name: 'web',
          active: true,
          events: [
          config: {
            url: targetUrl,
            content_type: 'json'

Any help would be appreciated
Thanks a bunch,

Hi @Soumyajyoti_Bhadra,
First of all welcome to the community :wave: :tada:

From the snippet provided, we can see URL is assigned but used as aURL in $request, can you help us eliminate that factor and if you are still facing issues with generateTargetURL please update this thread with the error message you receive to help debug this issue.

Few pointers

  1. In server.js - we can access iparams using args Eg. args.iparams.username
  2. Failure handler for generateTargetUrl can help us get the error message.(Sample code)
  3. Ensure we have handler for onExternalEvent in server.js.

Hello Raghu.
Thanks a lot .MIssed the onExternalEvent in the server.js
Adding it back helped in getting the same running