Closed laurentlp closed 2 years ago
@allardy I need more details on why we have to handle this when we call /invalidateFile
:
if (process.BPFS_STORAGE === 'disk') {
key = key.replace('::data/', '::')
}
We might want to move this logic inside a util function so that all services listening to invalidation can select the files they want to handle accordingly
**Describe the bug**\ In a workspace with 3 pipeline stages when a bot on some stage is overridden (using `on_request_change` pipeline hook below): 1. Newly added contents are not visible in the flow editor and contents page of the bot\ 2. Chat stops working\ May be related to [this](https://github.com/botpress/v12/issues/1569) issue. **To Reproduce**\ Steps to reproduce the behavior: 1. Set up a pipeline with 3 stages 2. Create an empty bot\ 3. Add some initial content to it\ 4. Promote the bot to the next stage\ 5. Promoted bot should work for now\ 6. Add some new content to the original bot and promote it again\ 7. Open the studio for the promoted bot. You should see newly added content-elements rendered empty and webchat not working\ \ **Expected behavior**\ The promoted bot should have a working webchat and render newly added content-elements in the flow editor **Environment (please complete the following information):** * OS: macOS * Browser Chrome * Browser Version Version 96.0.4664.110 (Official Build) (x86_64) * Botpress Version v12.26.7 * NodeJS v12.18.1 **Additional context**\ Add any other context about the problem here. [botpress/borpress botpress/v12#1581](https://github.com/botpress/v12/issues/1581) by [@ daukadolt](https://github.com/daukadolt)
This PR should fix an issue where overriding a bot with the same id (or uploading a bot with an id that already existed) would result in having outdated flow content.
Here is the reason why we should check for matches with and without the prefix
/data
: botpress/studio/#2This endpoint (
/invalidateFile
) is called whenever there is an invalidation in Botpress. Since we remove thedata/
part from the key when running using SQLite, the flow-service would discard the cache invalidation resulting in outdated flow data being used.I also updated the config loader and hint service to make sure that they watch for both keys containing or not the
data/
part.Closes https://github.com/botpress/v12/issues/1581 Closes DEV-2203
Testing
on_stage_request
hook using this code:You can then repeat these steps to see that the issue is not resolved.