שגיאת Javascript בתוסף Google Perspective API

סיכום מבוסס בינה מלאכותית

The Javascript error in Google Perspective API plugin discussion revolves around a TypeError caused by calling a finally() method on an undefined function. RGJ shared the error message and code snippet, suspecting the issue lies in the function not returning anything under certain circumstances.

sam noted the function appears to be intended as an async function, which is supported, and promised to look into the issue. martin took over the investigation and later proposed a fix in the form of a GitHub pull request (https://github.com/discourse/discourse-perspective-api/pull/43) in post #13.

We’re seeing this:

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.

7 לייקים

yeah … this kind of looks like it is intended to be an async function and these days we support that.

We will have a look over the next few weeks and get it sorted.

3 לייקים

Hi Richard, just letting you know I am looking into this issue now. Will let you know when I have a fix.

2 לייקים

I think this should fix the issue:

https://github.com/discourse/discourse-perspective-api/pull/43

Let me know if not!

3 לייקים

This topic was automatically closed after 4 days. New replies are no longer allowed.