Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

download Attachment And Write failed nodejs #1293

Closed
xiaolangxyz opened this issue Mar 6, 2019 · 6 comments · Fixed by #1323
Closed

download Attachment And Write failed nodejs #1293

xiaolangxyz opened this issue Mar 6, 2019 · 6 comments · Fixed by #1323

Comments

@xiaolangxyz
Copy link

Sample information

  1. Sample type: 15.handling-attachments
  2. Sample language: node js
  3. Sample name: 15.handling-attachments

Describe the bug

I upload an image. The bot saved it. But the image can not open. I think it is not saved correctly
By the way, I'm just running the sample. I didn't change anything.

1
2

@jwiley84
Copy link
Contributor

jwiley84 commented Mar 8, 2019

I was able to repro this issue using a PDF, and the v4 emulator

image

@jwiley84 jwiley84 closed this as completed Mar 8, 2019
@jwiley84 jwiley84 reopened this Mar 8, 2019
@Zerryth
Copy link
Contributor

Zerryth commented Mar 8, 2019

Same. Tried saving .jpg and .png files, which attaches to message to the bot, like the OP had done. However when trying to open the newly saved .jpg/.png files, it throws an error.

Here's the one that Microsoft Paint throws:
image

Should test bot in webchat, as it might be a webchat-related issue

@jwiley84
Copy link
Contributor

jwiley84 commented Mar 8, 2019

Quick step repro:

  • Emulator v4 (4.2.1) - Same error on png/jpg, txt files work as expected. Corrupts PDF
  • Emulator v3 (3.5.3) - Same error on png/jpg, txt files come through with text replaced with [Object object]
  • Webchat via iFrame from Azure - Same error on png/jpg, txt files work as expected
  • Facebook Messenger - Same error on png/jpg, txt files work as expected, EXCEPT that the file name had to be hardcoded in

@Zerryth
Copy link
Contributor

Zerryth commented Mar 8, 2019

Emulator 3.5.36

  • can upload and save .txt and .jpg/.png attachments, without bot throwing error
  • cannot open saved .jpg/.png. Gives error as shown above, about not liking the file type
  • can open .txt file, but the contents of the .txt file are replaced with only [object Object] written, nothing else

Emulator 4.3.0

  • cannot save any uploaded attachments.
    image

More specifically, contentURL seems to have a pending promise rather than settling to fulfilled/rejected in the attachment, and breaks when trying to call this line in bot.js.

image

@Zerryth
Copy link
Contributor

Zerryth commented Mar 8, 2019

Emulator team is aware of the image upload issue and is filed here.

@Zerryth
Copy link
Contributor

Zerryth commented Mar 12, 2019

Update: issue inside the emulator has been fixed.

For users who had problems simply saving the attachment to disk, you should no longer encounter the issue of uploading your attachment, even if it is an image.


C# attachments-bot runs without hiccup--saves attachment to AppData/Temp folder, and can open the saved attachment. However when running the node bot, attachment can upload, but when trying to open file type, the error of not being able to open a file of that type still persists.

Even when changing the save location of the node attachments to mimic the C# side and hard-coding save to AppData/Temp folder, attachment saves, but cannot open properly, so it doesn't appear to be a location issue, but perhaps a fs read/write issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants