microsoft / botbuilder-js

Welcome to the Bot Framework SDK for JavaScript repository, which is the home for the libraries and packages that enable developers to build sophisticated bot applications using JavaScript.
https://github.com/Microsoft/botframework
MIT License
685 stars 281 forks source link

getTranscriptActivities failing to retrieve transcripts from storage when passing in a start time #3864

Closed tomSauret847 closed 3 years ago

tomSauret847 commented 3 years ago

Github issues should be used for bugs and feature requests. Use Stack Overflow for general "how-to" questions.

Versions

What package version of the SDK are you using. 4.14.0 What nodejs version are you using 10.24.1 What browser version are you using N/A What os are you using Windows

Describe the bug

Give a clear and concise description of what the bug is. When listing the transcripts we are receiving a empty array const transcripts = await transcriptStore.getTranscriptActivities(channelId, convoId, undefined, startTime);

We are passing in a start time 15 minutes before the call to retrieve the transcripts using listTranscripts we can see there is 20 entrees in the store but unable to retrieve the content we are using the TranscriptLoggerMiddleware to record the transcripts when we retrieve the transcripts without passing in a start time we can get back all the activities for the conversation Id

To Reproduce

Steps to reproduce the behavior:

  1. Setup bot to use the trancriptLoggerMiddleware
  2. have a conversation with the bot
  3. At the end of the conversation use getTransriptActivities passing in a start time to list the conversation
  4. The call will return an empty array
  5. If you do not pass in a start time the call will return all the transcripts for the conversation Id

Expected behavior

Give a clear and concise description of what you expected to happen. Be able to retrieve the transcripts for the conversation that has taken place from the start time passed into the call

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here. Using the Teams channel the conversation Id never changes. This requires passing in a start time to retrieve the transcripts for the interaction that has just taken place and not the entire history that could be months old

stevkan commented 3 years ago

@tomSauret847, thank you for your patience. I will take a look at this and hope to have an update for you shortly.

stevkan commented 3 years ago

@tomSauret847, unfortunately, I am not able to repro the issue. Can you share code as well as what store you are using (Azure Blob Storage, CosmosDB, memory)?

As described here, this is what my code looks like, where the channel is directline, no continuationToken is being provided, and the date is a string ('7/20/2021 10:00:00'), using Azure Blob Storage:

const transcripts = await this.transcriptStore.getTranscriptActivities('directline', .activity.conversation.id, null, date);
tomSauret847 commented 3 years ago

Thank you @stevkan to answer your questions We are using Azure Blob Storage We are using the Teams and Direct line channels and debugging using the emulator here is the code we are using const startTime = new Date(); startTime.setMinutes(now.getMinutes() - 15); // get the last 15 minutes of transcripts const convoId = turnContext.activity.conversation.id; const channelId = turnContext.activity.channelId;
const history = await transcriptStore.getTranscriptActivities(channelId, convoId, undefined, startTime);

this sends in a time stamp formatted like Wed Jul 21 2021 06:34:51 GMT-0500 (Central Daylight Time)

This is working with the botbuilder-azure package, but when we moved over to the botbuilder-azure-blobs package we were no longer pulling back the transcripts

stevkan commented 3 years ago

@tomSauret847, this appears to be a legitimate bug. Once I switched libraries, I was able to repro the issue. If it is not a problem doing so, I would recommend switching back to the 'botbuilder-azure' library for the short-term until this bug is fixed.

@joshgummersall, repro steps:

  1. npm install botbuilder-azure-blobs (should be v4.14.1-preview)
  2. Implement transcript store using `new BlobsTranscriptSotre(CONNECTION_STRING, STORAGE_CONTAINER)
  3. Call getTranscriptActivities() at end of conversation, like so:
    • const startTime = new Date();
    • startTime.setMinutes(now.getMinutes() - 15); // get the last 15 minutes of transcripts
    • const convoId = turnContext.activity.conversation.id;
    • const channelId = turnContext.activity.channelId;
    • const history = await transcriptStore.getTranscriptActivities(channelId, convoId, undefined, startTime);
    • console log (or other) 'history'
  4. Start and end conversation with bot
  5. Observe returned empty array
tomSauret847 commented 3 years ago

Thank you @stevkan unfortunately we cannot switch back due to the security vulnerability that is in the botbuilder-azure package. We will wait for this bug to be fixed and move forward from here.

joshgummersall commented 3 years ago

Looks like a piece of data I expected the blob storage API to return did not exist. I just tested locally and am submitted a PR with a fix. Thanks for your patience and for filing the issue!