Skip to content

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'write' of null #35

@freerider7777

Description

@freerider7777

When having network problems, I received this Warning, though when network had recovered the connection restored without problems.

image

on "line 362", I'm periodically sending testing messages to FCM just to check connection:

image

// проверка соединения с FCM:
setInterval(function () {
    let from = "111222333";
    let message = new Message(from + "_ack").priority("high").dryRun(true)
        .addData("messageId", from)
        .deliveryReceiptRequested(true)
        .build();

    logger.info('Check connection... ' + new Date());

    xcs.sendNoRetry(message, from, function (result) {
        if (result.getError()) {
            if (result.getError() === 'BAD_REGISTRATION')
                logger.info("Check connection ok");
            else
                logger.error("Check connection ERROR! " + result.getError());
        } else {
            logger.info(`Check connection ${senderXcs.name} message sent: #` + result.getMessageId());
        }
    }); // Messages received from client (excluding receipts)

}, 120000);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions