Firebase cloud functions says Unreachable and each then() should return a value or throw promise/always-return

Yat*_*kku 3 node.js firebase firebase-cloud-messaging

Javascript code for Firebase cloud functions giving errors which written for push notifications

index.js

'use strict'
//Install functions and admin sdks'
const functions = require('firebase-functions');
const admin =require('firebase-admin');

admin.initializeApp(functions.config().firebase);

exports.sendNotification = functions.database.ref('/notifications/{user_id}/{notification_id}').onWrite((change, context) => {
    //onwrite will run if data changed
    const user_id = context.params.user_id;
    const notification = context.params.notification;

    if (context.params === null) {
        return console.log("Notification Has Been Deleted");
    }
    let token_id = null;
    const deviceToken = admin.database.ref(`/Users/${user_id}/device_token`).once('value');
    return deviceToken.then(result => {

        token_id = result.val();

        const payload = {
            notification:{
                title:"Friend Request",
                body:"You have recieved a new friend request",
                icon:"default"
            }
        };


    });


    return admin.messaging().sendToDevice(token_id, payload).then(response =>{
        console.log('This is the notify feature');
    }).catch(err => {
        console.log('Error getting documents', err);
    });

});
Run Code Online (Sandbox Code Playgroud)

When run firebase deploy command it is getting error as follows. I would be greateful if anyone can support.

Error

error Each then() should return a value or throw promise/always-return error Unreachable code no-unreachable error Each then() should return a value or throw promise/always-return

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ lint: `eslint .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the functions@ lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.      
Run Code Online (Sandbox Code Playgroud)

ari*_*rif 6

我希望它能正常工作,您应该像这样返回

return console.log('This is the notify feature');
Run Code Online (Sandbox Code Playgroud)