botbuilder-js icon indicating copy to clipboard operation
botbuilder-js copied to clipboard

File attachments for PDF produce turnError: Unknown attachment type

Open ruben-vb opened this issue 10 months ago • 3 comments

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

Versions

version 4.23.1, node 18

Describe the bug

issue in botbuilder-samples

As described here. It shows the same error for a base64 encoded file aswell as one provided using a url like so:

        const reply = { type: ActivityTypes.Message };

        reply.text = 'This is an inline attachment.';
        reply.attachments = [{
            name: 'dummy.pdf',
            contentType: 'application/pdf',
            contentUrl: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf'
        }];

        await context.sendActivity(reply);

Produces the error:

[onTurnError] unhandled error: RestError: Unknown attachment type

To Reproduce

Install botbuilder and try to send the above pdf as an attachment or really any pdf.

Expected behavior

PDF attached as a downloadable file

Additional context

The samples only provide examples for images. According to the documentation, other file formats which are not images/video/audio should also be possible even though there are no examples for them.

Also existed in version 4.20.0, but updating didn't fix it.

ruben-vb avatar Jan 16 '25 12:01 ruben-vb

@ruben-vb

Which client is the user communicating with the bot with? Web Chat, Teams, Slack, something else? I'm assuming, from the bit of included code, that the user is making a request for a file and the bot is then responding with the attached file, correct?

stevkan avatar Jan 16 '25 19:01 stevkan

@stevkan

The client is Teams. Kind of yeah, it's a RAG system with the possibility of images or other attachments being relevant to the answer. Attaching images (as additional attachments as above but also with the adaptive cards definition) works fine but as soon as I have 'application/pdf' as contentType its producing the error.

ruben-vb avatar Jan 17 '25 09:01 ruben-vb

@ruben-vb - Thank you for your patience. I was able to repro this in the Teams environment (as opposed to Web Chat, for instance where the issue did not repro). This is a Teams issue, as such. We will work on getting this in front of someone on Teams that can help.

stevkan avatar Mar 28 '25 23:03 stevkan

I'm also having this issue, with any attachment types, such as .txt, .pdf and .md (though I have not tested images). Even using the API directly instead of the SDK the issue happens. Has anyone got a solution yet?

eduardomagnussap avatar Nov 17 '25 19:11 eduardomagnussap