realm-js
realm-js copied to clipboard
Atlas Functions that return `undefined` return `null` when invoked by the JS SDK.
How frequently does the bug occur?
All the time
Description
when calling Realm.User.callFunction, if the Atlas Function in the cloud returns undefined
, the JS client on device returns null
.
Stacktrace & log output
n/a
Can you reproduce the bug?
Yes, always
Reproduction Steps
create and publish Atlas Function that returns undefined
such as the following:
// returnUndefined.js
exports = () => {return;};
then call function from the client:
const res = await app.currentUser.callFunction("returnUndefined");
console.log(res) // null
Version
10.19.3
What SDK flavour are you using?
Atlas App Services (auth, functions, etc.)
Are you using encryption?
No, not using encryption
Platform OS and version(s)
MacOS 11.6.3
Build environment
Node.js v16.13.2
Cocoapods version
No response
I believe this relates to https://github.com/realm/realm-js/issues/3530 .. at least this behaviour is mentioned in the note of that issue's description.