Hi team, I've been struggling with

Hi team, I've been struggling with something that should be very simple... How can I get the Answer name? Details: I have a SearchEmbed that when we save it we have the name and description given by the user... I would like to get this information but I am not able to find any event or prop such as LiveboardInfo for liveboards...
28 Replies
Geovane
GeovaneOP7mo ago
I thought about making requests to TS using the API to get this information... but I am getting some blockers with that + I am pretty sure there is an easier and direct way of getting the answer name...
ashish
ashish7mo ago
const service = await embed.getAnswerService();
const answer = await service.getAnswer();
console.log(answer.name, answer.description);
const service = await embed.getAnswerService();
const answer = await service.getAnswer();
console.log(answer.name, answer.description);
Available with 1.29.2 of the SDK
Geovane
GeovaneOP7mo ago
Thanks @ashish you are the best!
Geovane
GeovaneOP7mo ago
I was about to report some console.logs in the code but I saw that you already removed them as well! https://github.com/thoughtspot/visual-embed-sdk/commit/de069c7752ba50d8ad916c0616c36fe712d66200
Geovane
GeovaneOP7mo ago
Last question on this topic. I am able to save answers properly using events, however, the above-suggested code does not work unless I am also logged on ThoughtSpot with my main user. Regular users that are not logged on TS will get a non-authorized error. I thought the embed.current.getAnswerService() would already handle the auth as it did for the embed.current.on(EmbedEvent.Save, (response) => ...)). Am I missing something? Or could it be a bug? This is what I get as a regular user:
POST https://<myhost>/prism/?op=GetAnswer 401 (Unauthorized)
ashish
ashish7mo ago
I see, you might be using one of the cookieless authentications. This is a miss on the SDK side. Let me fix and publish a new version for you.
Geovane
GeovaneOP7mo ago
That is right, I am using cookieless auth. Thanks!!!
ashish
ashish7mo ago
Published 1.30.0, please check it out.
Geovane
GeovaneOP7mo ago
[A bigger text but it is to be helpful and give you as much information as possible] Hi @ashish, it seems that we are almost there. In fact, now with the new version I am authenticated and can fetch data perfectly when I keep the "Make this answer discoverable" checkbox checked ✅ . However, if I try to save a New Answer and uncheck the "Make this answer discoverable", it gives me an error (the session returns as undefined after a few seconds) ❌. Something curious is that when I called the service (embedRef.current.getAnswerService()) two times, I was able to get the session for the answer (<see_image_2>), then the AnswerService successfully store the Answer, but even though I got this error:
POST https://<my_host>>/prism/?op=GetAnswer 500 (Internal Server Error)
tokenizedFetch @ tokenizedFetch.js:29
await in tokenizedFetch (async)
graphqlQuery @ graphql-request.js:20
executeQuery @ answerService.js:243
AnswerService @ answerService.js:63
getAnswerService @ ts-embed.js:1004
await in getAnswerService (async)
eval @ tab.report-builder.tsx:46
eval @ ts-embed.js:662
executeCallbacks @ ts-embed.js:654
messageEventListener @ ts-embed.js:258
POST https://<my_host>>/prism/?op=GetAnswer 500 (Internal Server Error)
tokenizedFetch @ tokenizedFetch.js:29
await in tokenizedFetch (async)
graphqlQuery @ graphql-request.js:20
executeQuery @ answerService.js:243
AnswerService @ answerService.js:63
getAnswerService @ ts-embed.js:1004
await in getAnswerService (async)
eval @ tab.report-builder.tsx:46
eval @ ts-embed.js:662
executeCallbacks @ ts-embed.js:654
messageEventListener @ ts-embed.js:258
It saves the Answer, but gives me this error on my application. Is that possible that there is either a security feature around the "Make this answer discoverable" or some kind of delay when this option is selected? Thank you so much for your assistance, let me know if I can help sharing anything else.
No description
No description
Geovane
GeovaneOP7mo ago
A 2nd error that I am getting is: - If I create an Answer with User A, User B is not being able to open this Answer regardless of the "Make this answer discoverable" is checked or not. ❌ - In case of User A = Admin, User A can open Answer from User B (regular user) ✅ - User B (regular) can open his own Answers ✅ I am attaching the error.
No description
Justin Mathew
Justin Mathew7mo ago
if possible @Geovane can you share the HAR files ?
Geovane
GeovaneOP7mo ago
Hi @Justin Mathew ! Thank you for the message. I will send you the files in a Direct Message
Justin Mathew
Justin Mathew7mo ago
@Geovane can you send here itself , so others also have access to it.
Geovane
GeovaneOP7mo ago
It might have private/company's information on the files, that is why I try to be careful 🙂
Justin Mathew
Justin Mathew7mo ago
i see, np i ll share with internal team i've shared the details with my team , will let u know cc: @shikharTS
Geovane
GeovaneOP7mo ago
Thank you!!! Hi @Justin Mathew , were you able to get any ETA on those 2 reported bugs? Is there something that I could do on my side to help? - Just a reminder that I am using TrustedAuthTokenCookieless. - I also repeated the tests on SDK 1.31.1 and the problem persists. Thanks for the assistance 🙌 .
Justin Mathew
Justin Mathew7mo ago
@Geovane let me get back to my team and confirm @Geovane https://discord.com/channels/1143209406037758065/1267887771457159218/1268268992695636061 i see this is the same
Geovane
GeovaneOP7mo ago
Thank you @Justin Mathew ! 🙌
Geovane
GeovaneOP6mo ago
Hi @Justin Mathew @ashish do you have any news about this bug? I updated to the newest version and it is still happening. On the new version it looks like there is even another issue with the GetAnswer: <attached_image> Is it better if I create a support ticket?
No description
shikharTS
shikharTS6mo ago
Are you using events to call this getAnswer API or the TS app itself is throwing this error?
Geovane
GeovaneOP6mo ago
This is how I am calling the AnswerService:
const service = await searchEmbedRef.current.getAnswerService();
const answer: TSAnswer = await service.getAnswer(); // <---- returns undefined
const service = await searchEmbedRef.current.getAnswerService();
const answer: TSAnswer = await service.getAnswer(); // <---- returns undefined
Geovane
GeovaneOP6mo ago
But this is for the new error. However, the original error in the thread is still happening... - However on the latest version seems to be worse... before it was failing only when the answer was NOT discoverable...now it does not work anymore regardless if it is discoverable or not Here are the values of service when I debug it: <attached_image>
No description
Geovane
GeovaneOP6mo ago
I will create another thread for that @shikharTS , but in general, we have been having a couple of issues on this related topic. Is there a way to increase the priority of it? On the attached image for example, the TS Platform internally says that an Answer that was just created, was last viewed 2 months ago... Another issue related to the Answer / Discoverability was this one I reported here too: https://discord.com/channels/1143209406037758065/1267887771457159218/1268268992695636061
No description
shikharTS
shikharTS6mo ago
Answer/Discoverability has been fixed by the relevant but might take some time to reach you. I think the best way is to create TS tickets for app issues..
ashish
ashish6mo ago
Please update to 1.32.4 to fix the API error.
Geovane
GeovaneOP6mo ago
API error fixed! Thank you! I will create a ticket for the Discoverability issues.
Justin Mathew
Justin Mathew5mo ago
hey @Geovane , are you still facing this issue ? https://discord.com/channels/1143209406037758065/1260633073712631808/1261429641722331291 i've tried it couple of times with the new SDK , can seem to repro this, is possible can you give it a try here : https://m8l3cm.csb.app click the GetAnswerSession it should show you the answer session i am able to get the answer session just after saving as well
shikharTS
shikharTS5mo ago
@Geovane were you able to check this?

Did you find this page helpful?