# Weird error in cloud functions

**URL:** <https://community.parseplatform.org/t/weird-error-in-cloud-functions/2910>\
**Category:** Cloud Code\
**Created:** [September 13, 2022, 6:29pm UTC](https://community.parseplatform.org/t/weird-error-in-cloud-functions/2910 "2022-09-13T18:29:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pwnedev](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/p/b38774/32.png) [@pwnedev](https://community.parseplatform.org/u/pwnedev)\
**Post date:** [September 13, 2022, 6:29pm UTC](https://community.parseplatform.org/t/weird-error-in-cloud-functions/2910/1 "2022-09-13T18:29:38Z")

</div>

Hey guys, I got 2 questions, but first:

The error shown in console and logs:

```auto
{
  "code": 121,
  "level": "error",
  "message": "Nested keys should not contain the '$' or '.' characters",
  "stack": "Error: Nested keys should not contain the '$' or '.' characters\n at C:\\Users\\User1\\Documents\\GitHub\\testing-parse-server\\node_modules\\parse-server\\lib\\Controllers\\DatabaseController.js:522:21\n at processTicksAndRejections (node:internal/process/task_queues:96:5)",
  "timestamp": "2022-09-13T18:00:00.162Z"
}

```

The code used:

```auto
/* Some context:
*
* ipsArray = { '::ffff:127.0.0.1': { loginCounter: 0, logoutCounter: 1 } }
* So I can't use the key "::ffff:127.0.0.1" because it contains the "." char
*/

userRow.set("ip", ipsArray);
try {
  await userRow.save(null, { useMasterKey: true });
} catch(error) {
  throw "Something went wrong on logout. (Code 0)";
}

```

So the problem is that I can’t have an object key with the “$” or “.” character.  
I suppose I can replace every “.” and “$” for another char.

1. But why can’t we use this chars in object keys? I can set it manually in my database so it’s not a problem with MongoDB. Is this a limitation of Parse?

2. Now the weird one, using “throw” inside that catch crashes the server, why? I usually use “throw” without any problems and it just returns the message to the client without crashing the server.

Thanks In Advance!

---

<div class="post-metadata">

**Author:** ![pwnedev](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/p/b38774/32.png) [@pwnedev](https://community.parseplatform.org/u/pwnedev)\
**Post date:** [September 20, 2022, 5:57pm UTC](https://community.parseplatform.org/t/weird-error-in-cloud-functions/2910/2 "2022-09-20T17:57:16Z")

</div>

1. It is a Parse limitation.
2. Still not sure why the crash.

---

<div class="post-metadata">

**Author:** ![JeffGuKang](https://community.parseplatform.org/user_avatar/community.parseplatform.org/jeffgukang/32/297_2.png) [@JeffGuKang](https://community.parseplatform.org/u/JeffGuKang)\
**Post date:** [September 24, 2022, 5:02am UTC](https://community.parseplatform.org/t/weird-error-in-cloud-functions/2910/3 "2022-09-24T05:02:27Z")

</div>

1. 

You may check the issue. [Server crashed if asynchronous function get error. (uncaughtException) · Issue #8193 · parse-community/parse-server · GitHub](https://github.com/parse-community/parse-server/issues/8193)

---

<div class="post-metadata">

**Author:** ![pwnedev](https://community.parseplatform.org/letter_avatar_proxy/v4/letter/p/b38774/32.png) [@pwnedev](https://community.parseplatform.org/u/pwnedev)\
**Post date:** [September 24, 2022, 2:03pm UTC](https://community.parseplatform.org/t/weird-error-in-cloud-functions/2910/4 "2022-09-24T14:03:02Z")

</div>

Just a note, If you use `throw new Error(error.message)` instead of throwing a string it doesn’t crash.

---

<div class="post-metadata">

**Author:** ![JeffGuKang](https://community.parseplatform.org/user_avatar/community.parseplatform.org/jeffgukang/32/297_2.png) [@JeffGuKang](https://community.parseplatform.org/u/JeffGuKang)\
**Post date:** [September 26, 2022, 4:54am UTC](https://community.parseplatform.org/t/weird-error-in-cloud-functions/2910/5 "2022-09-26T04:54:21Z")

</div>

I recommend to use `new Parse.Error`.
