Notification Send Issue in Server

In this Scenario, I am trying to sent a notification from one user to another user through an Api call with payloads.

let notificationSystem: nkruntime.RpcFunction=(
ctx:nkruntime.Context,
logger:nkruntime.Logger,
nk:nkruntime.Nakama,
payload:string
)=>{

let user_id=ctx.userId;

let parsedPayload : { frienduserID :string; notify_content:string}=JSON.parse(payload);

let receiverId:string = parsedPayload[“frienduserID”];
let type_value:string = parsedPayload[“notify_content”];

logger.info("Receiver ID: " + JSON.stringify(receiverId));
logger.info("type_value : " + JSON.stringify(type_value));

let subject = “Notification”;

let content = {type: type_value};

let code = 101;

let senderId =user_id ;
let persistent = false;

try {
nk.notificationSend(receiverId, subject, content, code, senderId, persistent);
}
catch (error: any) {
logger.error(JSON.stringify(error.message));
return JSON.stringify({ error: error.message });
}
}

So, I tried to test this from nakama Api explorer Shows this error,
please help to resolve this, i’m stuck for 1 week

Hello @Albertcleetus, have you inspected the server logs for error?

No error, Just Logs like this

Then the function is working correctly and this is likely a bug in the API Explorer, if you return “{}” instead of an empty string in the function you should not see the error in the explorer anymore.

it’s a bug api explorer then, i call this API from client.
What this means “{}” In the code, what it means i didn’t get, can you please share the code from my code,
please correct me

The console UI seems to expect valid JSON to be returned, so if you end your RPC code with return "{}" it’ll return valid JSON and the console shouldn’t complain anymore.

I’m not entirely certain this was the original issue though, perhaps your JSON contained an invalid character.