AWS server can transfer via GUI but not via scripting

Advertisement

sparkei1
Guest

AWS server can transfer via GUI but not via scripting

Hi
Version of WinSCP 5.19.6- using version downloaded for automation.
Issue
We are trying to automate to an Amazon AWS transfer family server to send a small csv of hundreds of kb. What happens though is via any scripting or automation the server will only accept one line of csv data. Any more and the server we are sending to times out does not respond and using different software and wireshark found it would fail for 19 seconds with the server not responding. When trying to send via the GUI this issue does not persist which is what is difficult to understand.
We have limited availability to get server side to see why it does not respond. The root directory is "/" where we save to with the AWS url, I saw some notes around this in FAQs but can get files list ok from this directory so not sure where to go around this.
Is there anyone with further WinSCP automation able to advise any ideas of what I can do to get the file to put successfully using a script in this situation/ or point out what config settings on AWS side should be looked into

I have attached an example script. N.B. I was starting to list files in a local directory but it only
Exception calling "PutFiles" with "4" argument(s): "Timeout waiting for WinSCP to respond"
At \WinSCP-5.19.6-Automation\autoscript.ps1:34 char:5
+     $session.PutFiles("dir\test.csv
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : TimeoutException

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: AWS server can transfer via GUI but not via scripting

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

An equivalent log from GUI showing a successful upload of the same set of files would be useful too.

Reply with quote

sparkei
Joined:
Posts:
4
Location:
United Kingdom

Attached logs (2)

Attached logs.
I have $sessionOptions.AddRawSettings("SendBuf", "0") in the script ok on $session.Open($sessionOptions) so it doesn't solve the issue.
  • Logs2.zip (9.1 KB, Private file)

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,378
Location:
Prague, Czechia

Re: Attached logs (2)

In WinSCP GUI, you have turned off Automatic Resume / Transfer to Temporary Filename.
https://winscp.net/eng/docs/resume
https://winscp.net/eng/docs/ui_pref_resume
The script uses the default configuration, where this is turned on. While it should not be a problem in general, as you are using rare SFTP server, it might have a bug that causes troubles. Don't you have the option turned off in the GUI for this very reason? Won't turning it off in the script help?
Try adding -resumesupport=off to the put command:
https://winscp.net/eng/docs/scriptcommand_put#resumesupport

Reply with quote

sparkei
Joined:
Posts:
4
Location:
United Kingdom

Hi:
This has no affect. What now happens is the PowerShell script just hangs for slightly longer before failing and will still result in a 0kb file on the FTP server
Exception calling "PutFiles" with "4" argument(s): "Timeout waiting for WinSCP to respond"
At C:\temp\Folder\WinSCP-5.19.6-Automation\autoscript.ps1:40 char:5
+     $session.PutFiles("C:\temp\Folder\testusers_202202141 ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : TimeoutException

Reply with quote

Advertisement

chris.milne@live.com.au
Joined:
Posts:
3

Having the same issue - any hints on the firewall solution?

Hi, we are encountering the same issue with the GUI working, but not a PowerShell script. Have tried the suggestions in this article, however no luck.

Could you shed some light on what the firewall issue was?

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum