Bitrix24 not work push

  1. Problem with push server
  2. Error with padStart() function
  3. Replacing padStart function with simple code

Problem with push server

After installing 1C-Bitrix: The web environment of the boxed version of Bitrix24 not work push, notifications via the local server do not come (red line There is no connection to the server). In the Push and Pull settings, a local server with Virtual Machine 7.3 and newer (Bitrix Push server 2.0) was selected, the rest of the default settings.

Error with padStart() function

In the push server logs ( var/log/push-server/error and /var/log/push-server/system-error), the same error was repeated:

uncaughtException: (++ requestId).toString(…).padStart is not a function

As it turned out, the padStart function appeared in node 7 version, and node 6 was installed with the environment (why so – a question for developers):

node --version

Replacing padStart function with simple code

The padStart function fills a line with another line up to a certain length and is used in the push server to create unique identifiers for log records. The best solution, of course, would be to upgrade node to version 8. But since I don’t know which modules this might affect, it was decided to replace the padStart function with simple code, all the more so since the function is encountered only twice.

We open the editor /opt/push-server/lib/debug/index.js and in the getUniqueId() function replace ‘return + “T” + (++ requestId).toString().PadStart (8, “0” ); ‘to the following code:

function getUniqueId()
    newRequestId = (++requestId).toString();
    while(newRequestId.length < 8){
        newRequestId = '0'+ newRequestId;
    return + "T" + newRequestId;

//  return + "T" + (++requestId).toString().padStart(8, "0");

and in /opt/push-server/lib/storages/redis.js in the getMessageId(callback) function we replace ‘const id = Buffer.from (startDate + messageCounter.toString().padStart (16, “0”), “hex “);’ on the:

while(messageCounter.toString().length < 16){
    messageCounter = "0"+ messageCounter.toString();
const id = Buffer.from(startDate + messageCounter.toString(), "hex");
//const id = Buffer.from(startDate + messageCounter.toString().padStart(16, "0"), "hex");

Both files left commented out original lines.

After that, we reboot the push server:

service push-server restart

That’s all. The server will start, and the logs will no longer have errors associated with the padStart function.

Related article: Bitrix24 behind proxy

Leave a Comment