Uncaught (in promise) error

I was trying to use discord oauth2 api but i received this error in the console:

Sorry for the mess i tried to copy paste the error . So i wanted to know if there was something wrong with my http request so i made a simple function to see if it works,

This is my front end:

import {multiply} from 'backend/sever';

$w.onReady(function () {
    console.log(multiply(1,2))
});

This is my ‘sever.jsw’:

export function multiply(factor1, factor2) {
 return 2;
}

I was hoping that error would resolve but it was still displaying that error , even when there was no http request being made currently

Also i have also been experiencing some issues with the discord oauth 2 itself if someone cud help on that too it would be really really helpful

Thanks in advance!

See the article on how to call a web module function .

As you can see in the article, you call the multiply() function like this:

multiply(4,5).then(function(product) {
 console.log(product);
 // Logs: 20
});

Thank you so much for your quick reply appreciate it,
I changed like you said:

multiply(4,5).then(function(product) { 
console.log(product); 
});

but it still was giving that error, but this seemed to have stopped the error:

multiply(4,5).then(product => {
        console.log(product);
 // Logs: 20
    })
    .catch(error => {
        console.log(error);
    });

again thanks for your help!

Glad you got it worked out. Funny, I don’t know what function is doing there. It’s not needed, but I don’t know why it causes a problem. I’ll have to play with this and see what gives.