# Javascript error in Google Perspective API plugin

**URL:** <https://meta.discourse.org/t/javascript-error-in-google-perspective-api-plugin/226732>\
**Category:** Bug\
**Tags:** perspective-api\
**Created:** [May 11, 2022, 8:55am UTC](https://meta.discourse.org/t/javascript-error-in-google-perspective-api-plugin/226732 "2022-05-11T08:55:51Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [May 11, 2022, 8:55am UTC](https://meta.discourse.org/t/javascript-error-in-google-perspective-api-plugin/226732/1 "2022-05-11T08:55:51Z")

</div>

We’re seeing this:

```plaintext
TypeError: Cannot read properties of undefined (reading 'finally')
    at n.perspectiveSave (https://REDACTED/assets/plugins/discourse-perspective-api-12d54e93711215e76c0e9e41ddcbaff5276b541b4db8c82f8731e6544a60b4c6.js:1:1041)

```

which seems to come from calling a `finally()` method while the function before that in the chain is not returning anything under various circumstances (there are three `return` statements without arguments in the code).

I am not familiar enough with this specific logic to figure out what should be returned in these places.

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/3/0/d304195b8fa86fe0381ac540cad068db648ec752.png)

---

_[View the full topic](https://meta.discourse.org/t/javascript-error-in-google-perspective-api-plugin/226732)._
