0

I'm trying to deploy a node app to Heroku, but something related to the request-ip dependency of Rollbar is causing the app to crash.

The error message is:

throw new TypeError(`Expected a string, got "${typeof value}"`);

My web.js file looks like this:

require('dotenv').config({silent: true});

var express = require('express');

var Rollbar = require('rollbar');
var rollbar = new Rollbar({
  accessToken: process.env.ROLLBAR_ACCESS_TOKEN,
  captureUncaught: true,
  captureUnhandledRejections: true
});

var app = express();

app.use(rollbar.errorHandler());

The error is happening here:

/app/node_modules/rollbar/node_modules/request-ip/index.js:15

It appears the function getClientIpFromXForwardedFor in this module is not getting a String when it should be.

Anyone got any idea why this might be happening specifically on Heroku? I'm not having this problem locally.

4

0 回答 0