firebase cloud function: Function returned undefined, expected Promise or value

I'm calling this function to add a message to the database:

exports.addMessage = functions.https.onRequest((req, res) => {
    // Grab the text parameter.
    const original = req.query.text;
    // Push the new message into the Realtime Database using the Firebase Admin SDK.

    return admin.database().ref('/messages').push({
        original: original
    }).then((snapshot) => {
        // Redirect with 303 SEE OTHER to the URL of the pushed object in the Firebase console.
        return res.redirect(303, snapshot.ref);
    });
};

After that, there's a onwrite function to listen to this event and convert the text to uppercase.

exports.makeUppercase = functions.database.ref('/messages/{pushId}/original').onWrite((change, context) => {

    const afterSnapshot = change.after;
    const original = afterSnapshot.val();
    var key = context.params.pushId;

    const uppercase = original.toUpperCase();
    // You must return a Promise when performing asynchronous tasks inside a Functions such as
    // writing to the Firebase Realtime Database.
    // Setting an "uppercase" sibling in the Realtime Database returns a Promise.
    return admin.database().ref('/messages/'+key+'/uppercase').set(uppercase) // if assign this statement to a variable, it will have a value of promise {<pending>}
    .then((response) => {
        // Update databse successful (top up transaction)
        console.log('messages uppercase updated successfully!:', response); // !!! response is undefined
        return response;
    }).catch((error) => {
        // Update databse failed (top up transaction)
        console.log('Error updating messages uppercase:', error);
        return error;
    });      
};

However, I'm hitting this error in firebase console logs:

Function returned undefined, expected Promise or value

How to get rid of this error?