Getting this error for function,
"TypeError: key.startsWith is not a function" and I don't know what happens. Can anyone help me to solve this problem. Here is my code in the function.
msg.chatId= msg.payload.chatId;
if (msg.payload.type === "voice"){
return [null, msg,null];
}else{
if (msg.payload === "RestLang"|| msg.payload === "/start" ){
global.set(msg.chatId,0);
msg.payloadtran= "test1";
msg.payload = "Welcome to Translator Bot!! \nTranslator Bot is a translation app used IBM services to make the translation smart and easy. \n In this version you can use translation in the following: \n- Arabic to English\n- English to Arabic\n- Spanish to English\n- French to English\n- Japanese to English\nand we will support more language in the future.\nTo start the translation try to say \nHello, مرحبا, Hola, Bonjour, こんにちは \nby your voice to set the default language. \nor type anything in the supported language and the app will identify the language then translate it. ";
return [null,null, msg];
}else{
Are you sure the error is coming from that function? Give the function node a name, if it does not already have a name, then it will be identified with the error. Alternatively you can use the Search feature to search for the node id (the string of characters with a dot in the middle).
Hi @NURULSYIFA98,
Can you share (i.e. export) a "simple" flow with a function node, and an inject node (which injects an example message that causes the error). That makes it easy for us to help people.
BTW if you need to implement multiple function nodes, it might be worth to learn debugging your function node code. You can do that very easily as described here.
For debugging simple function nodes I find it is usually enough just to use node.warn() as described in the docs for Writing Functions. For more complex issues then the technique linked above is a good way to go.