RocketChat / RocketChat/Rocket.Chat
Auto Translation - /api/v1/autotranslate.translateMessage never returns exception on Translation failed
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description:
The Rest API endpoint /api/v1/autotranslate.translateMessage will always return { success: true } even if the request to the translation providers is failed. This makes debugging impossible because we cannot know what is happening.
Steps to reproduce:
- Enable Auto Translation with an API that exceeded the quota
- Send an API request to
/api/v1/autotranslate.translateMessage
Expected behavior:
A detailed error response returned
Actual behavior:
Success response returned
Server Setup Information:
- Version of Rocket.Chat Server:
- Operating System: Linux
- Deployment Method: docker
- Number of Running Instances: 1
- DB Replicaset Oplog: enabled
- NodeJS Version: 12.18.4
- MongoDB Version: 4
Client Setup Information
- Desktop App or Browser Version: Browser
- Operating System: Windows
Additional context
- DeepL's API returns error codes quite detailed https://www.deepl.com/docs-api/accessing-the-api/error-handling/. We can also monitor the remaining quota by their API https://www.deepl.com/docs-api/other-functions/monitoring-usage/
- Rocket.Chat's auto-translation API does not return any error code or error message
/rocket.chat/app/autotranslate/server/deeplTranslate.js:188. Response value always issuccess: true
Relevant logs:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at rocket.chat/app/autotranslate/server/deeplTranslate.js:188 and trace the /api/v1/autotranslate.translateMessage request through the translation provider failure path. Reproduce the case with a provider quota exceeded, then verify that the endpoint returns the provider's detailed error instead of success: true.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100