Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions from nakama functions in RPC #1122

Open
AlexandreK38 opened this issue Oct 31, 2023 · 0 comments
Open

Exceptions from nakama functions in RPC #1122

AlexandreK38 opened this issue Oct 31, 2023 · 0 comments
Assignees

Comments

@AlexandreK38
Copy link

AlexandreK38 commented Oct 31, 2023

Description

Hi!
Using the nakama typescript runtime, I faced an issue with the exceptions thrown by a nakama function called in an RPC. Currently the error we have in the client is an INTERNAL error, with message specifiying the original code and message. It is probably the current behavior, but it would be great to have the original exception as it.

Steps to Reproduce

  1. Register a user on nakama
  2. Create a RPC on the server like this one:
let checkCredentialsRpc: nkruntime.RpcFunction =
function (ctx: nkruntime.Context, logger: nkruntime.Logger, nk: nkruntime.Nakama, payload: string) {
    const args : Credentials = JSON.parse(payload);

    let result = nk.authenticateEmail(args.email, args.password, "", false);

    return JSON.stringify(result);
}
  1. Call the RPC from the client using an email not existing or bad credentials so nk.authenticateEmail will trigger an exception and check the error code (INTERNAL) and message

Expected Result

If email doesn't exist: code: NotFound and message: User account not found
If credentials don't match: code: InvalidArgument and message: Invalid credentials

Actual Result

If email doesn't exist: code: Internal and message: error authenticating: rpc error: code = NotFound desc = User account not found.)
If credentials don't match: code: Internal and message: error authenticating: rpc error: code = InvalidArgument desc = Invalid credentials.)

Context

Client: Nakama-Cpp 2.8.0

Your Environment

  • Instance on Heroic Cloud
  • Nakama: 3.17.1-r2
@sesposito sesposito self-assigned this Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants