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

user.callFunction returns 'Assertion failed' if called with no args instead of simple error #3718

Closed
sync-by-unito bot opened this issue May 7, 2021 · 0 comments · Fixed by #3734
Closed
Assignees

Comments

@sync-by-unito
Copy link

sync-by-unito bot commented May 7, 2021

Note

I am reporting this issue as I see the following message in the terminal

IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new

Goals

Call a simple function which requires no args as authenticated user.

Expected Results

{{user.callFunction("some_function_name") }}

should either throw a simple error explaining that callFunction expects both name and args or default args to empty array if none are passed.

Actual Results

./vendor/realm-core/src/realm/object-store/util/bson/bson.hpp:201: [realm-core-10.6.0] Assertion failed: m_type == Bson::Type::Array
0   realm.node                          0x0000000105d8752c _ZN5realm4utilL18terminate_internalERNSt3__118basic_stringstreamIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 28
1   realm.node                          0x0000000105d8782b _ZN5realm4util9terminateEPKcS2_lOSt16initializer_listINS0_9PrintableEE + 395
2   realm.node                          0x00000001058cb986 _ZN5realm2js9UserClassINS_4node5TypesEE13call_functionEN4Napi3EnvENS5_6ObjectERNS0_9ArgumentsIS3_EERNS0_11ReturnValueIS3_EE + 1174
3   realm.node                          0x00000001058c6315 _ZN5realm2js4wrapIXadL_ZNS0_9UserClassINS_4node5TypesEE13call_functionEN4Napi3EnvENS6_6ObjectERNS0_9ArgumentsIS4_EERNS0_11ReturnValueIS4_EEEEEENS6_5ValueERKNS6_12CallbackInfoE + 293
4   realm.node                          0x00000001058ce57b _ZZN4Napi12InstanceWrapIN5realm4node13WrappedObjectINS1_2js9UserClassINS2_5TypesEEEEEE29InstanceMethodCallbackWrapperEP10napi_env__P20napi_callback_info__ENKUlvE_clEv + 139
5   realm.node                          0x00000001058ce49a _ZN4Napi12InstanceWrapIN5realm4node13WrappedObjectINS1_2js9UserClassINS2_5TypesEEEEEE29InstanceMethodCallbackWrapperEP10napi_env__P20napi_callback_info__ + 42
6   node                                0x000000010005eefa _ZN6v8impl12_GLOBAL__N_123FunctionCallbackWrapper6InvokeERKN2v820FunctionCallbackInfoINS2_5ValueEEE + 122
7   node                                0x000000010024a488 _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE + 616
8   node                                0x0000000100249a49 _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb0EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEESA_NS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EENS0_16BuiltinArgumentsE + 521
9   node                                0x00000001002491b2 _ZN2v88internalL26Builtin_Impl_HandleApiCallENS0_16BuiltinArgumentsEPNS0_7IsolateE + 258
10  node                                0x00000001009ce9d9 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit + 57
11  node                                0x0000000100954284 Builtins_InterpreterEntryTrampoline + 676!!! IMPORTANT: Please report this at https://github.com/realm/realm-core/issues/new/choosesh

Steps to Reproduce

Define a function named 'test_function' like so in the realm UI and in the settings allow an api-key authenticated user to call it via user id authentication.

exports = function() {
  return "HELLO";
};

From node log in a user and try call the function without passing args.

const app = new App({ id: appId });

const credentials = Credentials.serverApiKey(apiKey);

const user = await app.logIn(credentials);

user.callFunction('test_function');

Version of Realm and Tooling

  • Realm JS SDK Version: ^10.4.0
  • Node: 12.18.2
  • Client OS & Version: macOS Mojave 10.14.6
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant