botpress / studio

The studio is the main interface you'll use to build and edit your chatbot.
https://botpress.com/docs/quickstart#conversation-studio
35 stars 37 forks source link

fix(cloud): cloud router error handling #339

Closed EFF closed 2 years ago

EFF commented 2 years ago

Ok this seems like a lot but its majorly moving code around in some private functions and provide better error handling when trying to deploy a chatbot to bp cloud.

Essentially if you look at the original code, request were never closed in the advent of an error. res.status(400) will not send a response. I simply replace the sending of status code by throwing our standard http errors and let the asyncMiddleware do its job.

The end result is pretty simple, when everything is fine, the chatbot gets deployed.

Screen Shot 2022-04-13 at 11 39 38 PM

When there is an error, a proper error message is displayed in the ui. Ex:

Screen Shot 2022-04-13 at 5 09 32 PM Screen Shot 2022-04-13 at 5 11 45 PM Screen Shot 2022-04-13 at 5 10 38 PM

Ui also renders the error message provided in the response body if present, in the case of an unexpected error see custom here :

Screen Shot 2022-04-13 at 4 46 50 PM

In the end this will provide much better information to the end user and support. Notice that I also added proper logging which avoids a support nightmare.

closes BUS-334

linear[bot] commented 2 years ago
BUS-334 [Spike] verify that uploading a file from the Studio fails gracefully

**Original description:** [https://botpresshq.slack.com/archives/C02AFENA9C5/p1646840391855839](https://botpresshq.slack.com/archives/C02AFENA9C5/p1646840391855839) When I try to deploy a Bot I got a CORS Policy error\ The bot is in the list of bot [image.png](https://uploads.linear.app/86b5451b-0c34-4f42-8d54-be35c275a26b/83dd0d25-f639-46b5-9c1b-66ad25b64749/8ddc6275-6a7c-4f01-8ac8-fe955b9788db) **Description:** We can only upload a bot to the Cloud using *Deploy to Cloud* in the Studio now. Make sure upload errors are handled gracefully. **Dependencies:** **Acceptance criteria \[Definition of Done\]:** **Testing:**

laurentlp commented 2 years ago

I get this error when I delete my bot on the CDM and then try to re-deploy it:

I think this error might be misleading since it contains a : at the end of the error message, which makes me think there is something more when there isn't:

Screenshot from 2022-04-14 17-13-15

EFF commented 2 years ago

@laurentlp weird there's no : https://github.com/botpress/studio/blob/610c4ac076ceeb769f32fa975af9ee631276b1ad/packages/studio-be/src/studio/cloud/cloud-router.ts#L81