Code for generating Installation Access Token no longer works - Returns empty response

I have this code for generating an Installation Access Token:

const axios = require("axios");
var fs = require('fs');
var jwt = require("jsonwebtoken");

var gitInstallationAccessToken = {

  genJWTToken: function(githubAppId, pemFilePath) {

    // Private key contents
    var private_key = fs.readFileSync(pemFilePath);

   // generate jwt
    const now = Math.round(Date.now() / 1000);
    const payload = {
      // issued at time
      iat : now,
      // expires in 10min
      exp : now + (8 * 60),
      // Github app id
      iss : githubAppId
    };

    const token = jwt.sign(payload, private_key, { algorithm: 'RS256' })
    console.log('token: ', token);
    return token;
  },

  getAccessTokensUrl: function(jwt, callback) {

    console.log('token2: ', jwt);

    var installationsUrl = "https://api.github.com/app/installations";

    var instance = axios({
      method: "GET",
      url: installationsUrl,
      headers: {
        "Accept" : "application/vnd.github.machine-man-preview+json",
        "Authorization" : `Bearer ${jwt}`
      }
    })
    .then(function(response) {

      var accessTokensUrl = response.data[0].access_tokens_url;
      callback(accessTokensUrl);
    })
    .catch(function(error) {
      console.warn(`Unable to retrieve accessTokensUrl from ${installationsUrl}`);
      console.warn(`ERROR: ${error}`);
      // The request was made and the server responded with a status code
      // that falls out of the range of 2xx
      if (error.response) {
        console.warn(`Status ${error.response.status}`);
        console.warn(`${error.response.data.message}`);
      }
    });
  },

  genInstallationAccessToken: function(githubAppId, pemFilePath, callback) {

    console.log('githubAppId: ', githubAppId);
    console.log('pemFilePath: ', pemFilePath);

    var jwt = gitInstallationAccessToken.genJWTToken(githubAppId, pemFilePath);

    gitInstallationAccessToken.getAccessTokensUrl(jwt, function(appAccessTokensUrl) {

      //console.log(`Retrieving access token from url: ${appAccessTokensUrl}`)

      var instance = axios({
        method: "POST",
        url: appAccessTokensUrl,
        headers: {
          "Accept" : "application/vnd.github.machine-man-preview+json",
          "Authorization" : `Bearer ${jwt}`
        }
      })
      .then(function(response) {
        var installationAccessToken = response.data.token;
        //console.log(`Installation Access Token: ${installationAccessToken}`)
        callback(installationAccessToken);
      })
      .catch(function(error) {
        console.warn("Unable to authenticate");
        // The request was made and the server responded with a status code
        // that falls out of the range of 2xx
        if (error.response) {
          console.warn(`Status ${error.response.status}`);
          console.warn(`${error.response.data.message}`);
        }
      });
    });
  }
}

module.exports = gitInstallationAccessToken;

It previously worked but now returns this error:

TypeError: Cannot read property ‘access_tokens_url’ of undefined

The access_tokens_url isn’t in the response as you can see:

{ status: 200,
  statusText: 'OK',
  headers:
   { server: 'GitHub.com',
     date: 'Tue, 13 Nov 2018 19:48:12 GMT',
     'content-type': 'application/json; charset=utf-8',
     'content-length': '2',
     connection: 'close',
     status: '200 OK',
     'cache-control': 'public, max-age=60, s-maxage=60',
     vary: 'Accept',
     etag: '"5b49dc572fac1de90f6dcbe96af712d9"',
     'x-github-media-type': 'github.machine-man-preview; format=json',
     'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type',
     'access-control-allow-origin': '*',
     'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
     'x-frame-options': 'deny',
     'x-content-type-options': 'nosniff',
     'x-xss-protection': '1; mode=block',
     'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
     'content-security-policy': 'default-src \'none\'',
     'x-github-request-id': 'F6A0:223A:3E7AF15:7F929C0:5BEB2A7B' },
  config:
   { adapter: [Function: httpAdapter],
     transformRequest: { '0': [Function: transformRequest] },
     transformResponse: { '0': [Function: transformResponse] },
     timeout: 0,
     xsrfCookieName: 'XSRF-TOKEN',
     xsrfHeaderName: 'X-XSRF-TOKEN',
     maxContentLength: -1,
     validateStatus: [Function: validateStatus],
     headers:
      { Accept: 'application/vnd.github.machine-man-preview+json',
        Authorization: 'Bearer blablabla',
        'User-Agent': 'axios/0.18.0' },
     method: 'get',
     url: 'https://api.github.com/app/installations',
     data: undefined },
  request:
   ClientRequest {
     domain: null,
     _events:
      { socket: [Function],
        abort: [Function],
        aborted: [Function],
        error: [Function],
        timeout: [Function],
        prefinish: [Function: requestOnPrefinish] },
     _eventsCount: 6,
     _maxListeners: undefined,
     output: [],
     outputEncodings: [],
     outputCallbacks: [],
     outputSize: 0,
     writable: true,
     _last: true,
     upgrading: false,
     chunkedEncoding: false,
     shouldKeepAlive: false,
     useChunkedEncodingByDefault: false,
     sendDate: false,
     _removedConnection: false,
     _removedContLen: false,
     _removedTE: false,
     _contentLength: 0,
     _hasBody: true,
     _trailer: '',
     finished: true,
     _headerSent: true,
     socket:
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: null,
        npnProtocol: undefined,
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 9,
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: 'api.github.com',
        _readableState: [Object],
        readable: false,
        domain: null,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 626,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: null,
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: [Circular],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        [Symbol(asyncId)]: 24,
        [Symbol(bytesRead)]: 937 },
     connection:
      TLSSocket {
        _tlsOptions: [Object],
        _secureEstablished: true,
        _securePending: false,
        _newSessionPending: false,
        _controlReleased: true,
        _SNICallback: null,
        servername: null,
        npnProtocol: undefined,
        alpnProtocol: false,
        authorized: true,
        authorizationError: null,
        encrypted: true,
        _events: [Object],
        _eventsCount: 9,
        connecting: false,
        _hadError: false,
        _handle: null,
        _parent: null,
        _host: 'api.github.com',
        _readableState: [Object],
        readable: false,
        domain: null,
        _maxListeners: undefined,
        _writableState: [Object],
        writable: false,
        allowHalfOpen: false,
        _bytesDispatched: 626,
        _sockname: null,
        _pendingData: null,
        _pendingEncoding: '',
        server: undefined,
        _server: null,
        ssl: null,
        _requestCert: true,
        _rejectUnauthorized: true,
        parser: null,
        _httpMessage: [Circular],
        read: [Function],
        _consuming: true,
        _idleNext: null,
        _idlePrev: null,
        _idleTimeout: -1,
        [Symbol(asyncId)]: 24,
        [Symbol(bytesRead)]: 937 },
        _header: 'GET /app/installations HTTP/1.1\r\nAccept: application/vnd.github.machine-man-preview+json\r\nAuthorization: Bearer blablabla\r\nUser-Agent: axios/0.18.0\r\nHost: api.github.com\r\nConnection: close\r\n\r\n',
     _onPendingData: [Function: noopPendingOutput],
     agent:
      Agent {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        defaultPort: 443,
        protocol: 'https:',
        options: [Object],
        requests: {},
        sockets: [Object],
        freeSockets: {},
        keepAliveMsecs: 1000,
        keepAlive: false,
        maxSockets: Infinity,
        maxFreeSockets: 256,
        maxCachedSessions: 100,
        _sessionCache: [Object] },
     socketPath: undefined,
     timeout: undefined,
     method: 'GET',
     path: '/app/installations',
     _ended: true,
     res:
      IncomingMessage {
        _readableState: [Object],
        readable: false,
        domain: null,
        _events: [Object],
        _eventsCount: 3,
        _maxListeners: undefined,
        socket: [Object],
        connection: [Object],
        httpVersionMajor: 1,
        httpVersionMinor: 1,
        httpVersion: '1.1',
        complete: true,
        headers: [Object],
        rawHeaders: [Array],
        trailers: {},
        rawTrailers: [],
        upgrade: false,
        url: '',
        method: null,
        statusCode: 200,
        statusMessage: 'OK',
        client: [Object],
        _consuming: true,
        _dumped: false,
        req: [Circular],
        responseUrl: 'https://api.github.com/app/installations',
        redirects: [],
        read: [Function] },
     aborted: undefined,
     timeoutCb: null,
     upgradeOrConnect: false,
     parser: null,
     maxHeadersCount: null,
     _redirectable:
      Writable {
        _writableState: [Object],
        writable: true,
        domain: null,
        _events: [Object],
        _eventsCount: 2,
        _maxListeners: undefined,
        _options: [Object],
        _redirectCount: 0,
        _redirects: [],
        _requestBodyLength: 0,
        _requestBodyBuffers: [],
        _onNativeResponse: [Function],
        _currentRequest: [Circular],
        _currentUrl: 'https://api.github.com/app/installations' },
     [Symbol(outHeadersKey)]:
      { accept: [Array],
        authorization: [Array],
        'user-agent': [Array],
        host: [Array] } },
  data: [] }

I can confirm that the code hasn’t changed and if I run this curl, which I got at the GitHub Application Authentication page, I get the below response:

curl -i -H "Authorization: Bearer blablabla"-H "Accept: application/vnd.github.machine-man-preview+json" https://api.github.com/app/installations  
  

HTTP/1.1200 OKServer:GitHub.comDate:Wed,14Nov201820:43:04 GMTContent-Type: application/json; charset=utf-8Content-Length:5Status:200 OKCache-Control:public, max-age=60, s-maxage=60Vary:AcceptETag:"5b49dc572fac1de90f6dcbe96af712d9"X-GitHub-Media-Type: github.machine-man-preview; format=jsonAccess-Control-Expose-Headers:ETag,Link,Location,Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-TypeAccess-Control-Allow-Origin:\*Strict-Transport-Security: max-age=31536000; includeSubdomains; preload X-Frame-Options: deny X-Content-Type-Options: nosniff X-XSS-Protection:1; mode=blockReferrer-Policy: origin-when-cross-origin, strict-origin-when-cross-originContent-Security-Policy:default-src 'none'X-GitHub-Request-Id: E867:223A:47CF7F2:924E87D:5BEC88D8[]

Is there any reason that I get an empty response? I’m guessing possibly some change in the API or an issue with my GitHub Application.