OfficeDev / microsoft-teams-library-js

JavaScript library for use by Microsoft Teams apps
https://docs.microsoft.com/microsoftteams/platform/
Other
426 stars 194 forks source link

clipboard.write(...) throws internal error (500) in personal tab #2353

Open thierschi opened 3 months ago

thierschi commented 3 months ago

I want to copy text to a user's clipboard. In the past I implemented this using the clipboard-api from teams-js. Recently this stopped working.

I tried the function in a simple button to eliminate errors on my side and made a simple button for testing:

<Button
    onClick={async () => {
        try {
            if (clipboard.isSupported()) {
                const blob = new Blob(["Hello"], {
                    type: "text/plain",
                });
                await clipboard.write(blob);
            }
        } catch (e) {
            console.error(e);
        }
    }}
>
    Test
</Button>

When trying to run this, clipboard.write(...) throws the following error:

{
    "errorCode": 500,
    "message": "An internal error occurred"
}

I've tested this in the Teams v2 Mac-App and on the web in Chrome, both show the same behaviour. In Chrome I also made sure that the teams website has access to my clipboard. Debugging into the clipboard.write() function didn't give me any hints. Maybe an issue on the receiving side of the message mechanism.

@microsoft/teams-js: 2.23.0
Teams-Version Mac-App: 24124.1411.2908.8258.
Teams-Version Web: 1415/24051622207
microsoft-github-policy-service[bot] commented 3 months ago

Hi thierschi! Thank you for bringing this issue to our attention. We will investigate and if we require further information we will reach out in one business day. Please use this link to escalate if you don't get replies.

Best regards, Teams Platform

Nivedipa-MSFT commented 3 months ago

@thierschi - Thanks for reporting your issue. We are checking this internally, we will update you soon.

shrshindeMSFT commented 3 months ago

Thank you for reporting this issue @thierschi. We will update this thread as soon as we have a fix for this bug.

ZimnitskiYury commented 3 months ago

also some notes from #2196

microsoft/teams-js: 2.24.0 Microsoft Teams version: 24137.2216.2931.2440 The client version is 49/24050307617.

if i write to clipboard image:

if I write to clipboard text/plain or text/html:

shrshindeMSFT commented 3 months ago

Update: There is a fix deployed for clipboard.write() throwing internal error on web and desktop. Also, there is some work going on regarding the Clipboard: Document is not focused. We will keep updating this thread as we get closer to resolving this issue. Thank you for your patience.