Page 1 of 1

Issues with SFTP Get Files command

Posted: Tue Dec 20, 2016 11:42 am
by Artis_Wright
Guten Tag!

I created a project that connects via SFTP and grabs a file to place it somewhere on our server. However, according to the debug I posted below, it looks like the connection closes after it attempts to get the file. I am at a lost as the only thing I am told by this debug is ERROR bad message and "Routing the control to the module 'failed'.
Code: Select all
Dec 20, 2016 10:33:30 AM      INFO      ******************** Debug Mode ********************
Dec 20, 2016 10:33:30 AM      INFO      Executing project 'FTP Rec'
Dec 20, 2016 10:33:30 AM      INFO      Project location: C:\Program Files\Linoma Software\GoAnywhere\userdata\projects\awright\FTP Rec.xml
Dec 20, 2016 10:33:30 AM      INFO      Executing module 'Main'
Dec 20, 2016 10:33:33 AM      INFO      Executing task 'sftp 1.0 (####)'
Dec 20, 2016 10:33:33 AM      INFO      Connecting to '####' at port '####' as user '####'
Dec 20, 2016 10:33:35 AM      INFO      Executing sub-task 'get'
Dec 20, 2016 10:33:35 AM      INFO      Closed the FTP connection
Dec 20, 2016 10:33:35 AM      INFO      Closed the FTP connection
Dec 20, 2016 10:33:35 AM      ERROR    Bad message
Dec 20, 2016 10:33:35 AM      INFO      Routing the control to the module 'Failed'

Re: Issues with SFTP Get Files command

Posted: Tue Dec 20, 2016 12:56 pm
by Support_Rick
Please email or post your full project XML and Debug Joblog.

You can email this to our [email protected] or post it here.

We need to see this to give a full recommendation as to what's happening.

Re: Issues with SFTP Get Files command

Posted: Wed Dec 21, 2016 10:09 am
by Artis_Wright
Sorry about that, I knew I was forgetting something. Here is the code.
Code: Select all
<project name="FTP Rec" mainModule="Main" version="2.0" logLevel="verbose">

	<module name="Main">

		<sftp label="Harcros" resourceId="####" host="####" port="####" user="####" password="####" timeout="30" connectionRetryAttempts="1" connectionRetryInterval="5" version="1.0" onError="call:Failed">
			<get destinationDir="folderX" whenFileExists="rename">
				<fileset dir="folderY" recursive="false">
					<wildcardFilter>
						<include pattern="*.*.*" caseSensitive="true" />
					</wildcardFilter>
				</fileset>
			</get>
		</sftp>


		<exitProject version="1.0" />

	</module>

Re: Issues with SFTP Get Files command

Posted: Tue Dec 27, 2016 9:59 am
by Support_Rick
If you're SFTP resource is defined under your Resources, then you shouldn't need the additional information in your Project. It should just look like this:

<sftp label="Harcros" resourceId="####" version="1.0" onError="call:Failed">

Also, when retrieving all files from a folder, you can just designate the FileSet Folder without any filters. It should look like this:

<get destinationDir="folderX" whenFileExists="rename">
<fileset dir="folderY" recursive="false"/>
</get>

Try those changes and see what happens.

Re: Issues with SFTP Get Files command

Posted: Thu Dec 29, 2016 10:07 am
by Artis_Wright
Guten Tag,

I tried what you suggested and got the same error message as before, it attempts to execute sub-task 'get' and then the ftp connection closes with a Bad message Error. "Routing the control to the module 'failed'". Here is the revised script.
Code: Select all
<project name="FTP Rec" mainModule="Main" version="2.0" logLevel="verbose">

<module name="Main">

<sftp label="Harcros" resourceId="####" host="####" port="####" user="####" password="####" timeout="30" connectionRetryAttempts="1" connectionRetryInterval="5" version="1.0" onError="call:Failed">
<get destinationDir="folderX" whenFileExists="rename">
<fileset dir="folderY" recursive="false"/>
</get>
</sftp>


<exitProject version="1.0" />

</module>

Re: Issues with SFTP Get Files command

Posted: Wed Jan 04, 2017 4:54 pm
by Support_Rick
Please send me your full Project XML as well as the latest JobLog in DEBUG mode.

This way I can review it...

Re: Issues with SFTP Get Files command

Posted: Fri Jan 06, 2017 10:41 am
by Artis_Wright
Here is the entire code:
Code: Select all
<project name="Harcros FTP Rec" mainModule="Main" version="2.0" logLevel="verbose">

	<module name="Main">

		<sftp label="Harcros" resourceId="Harcros Sunset" host="#####" port="#####" user="#####" password="#####" timeout="30" connectionRetryAttempts="1" connectionRetryInterval="5" version="1.0" onError="call:Failed">
			<get destinationDir="FolderX" whenFileExists="rename">
				<fileset dir="FolderY" recursive="false" />
			</get>
		</sftp>


		<exitProject version="1.0" />

	</module>


	<module name="Failed" disabled="true">

		<sendEmail resourceId="Delek Mail" toList="####" version="2.0">
			<from address="[email protected]" />
			<subject>
				<![CDATA[Harcros FTP Rec Failed]]>
			</subject>
			<message>
				<![CDATA[Did not receive acknowledgement. Check to see if a 210 was sent . If there is not one, contact Harcros and make sure they receive interchange.]]>
			</message>
		</sendEmail>


		<exitProject version="1.0" />

	</module>

</project>
Debug:
Code: Select all
Jan 6, 2017 9:39:37 AM        INFO      Start Date and Time: 1/6/17 9:39:37 AM
Jan 6, 2017 9:39:37 AM        INFO      Job Number: 1000000000295
Jan 6, 2017 9:39:37 AM        INFO      Project Name: /jwright/Harcros FTP Rec
Jan 6, 2017 9:39:37 AM        INFO      Submitted By: jwright
Jan 6, 2017 9:39:37 AM        INFO      Submitted From: Administrator UI
Jan 6, 2017 9:39:37 AM        INFO      GoAnywhere 5.3.4 running on Windows Server 2012 6.2 (amd64)
Jan 6, 2017 9:39:38 AM        INFO      ******************** Debug Mode ********************
Jan 6, 2017 9:39:38 AM        INFO      Executing project 'Harcros FTP Rec'
Jan 6, 2017 9:39:38 AM        INFO      Project location: C:\Program Files\Linoma Software\GoAnywhere\userdata\projects\jwright\Harcros FTP Rec.xml
Jan 6, 2017 9:39:38 AM        INFO      Executing module 'Main'
Jan 6, 2017 9:39:50 AM        INFO      Executing task 'sftp 1.0 (Harcros)'
Jan 6, 2017 9:39:50 AM        INFO      Connecting to '####' at port '####' as user '####'
Jan 6, 2017 9:39:51 AM        INFO      Executing sub-task 'get'
Jan 6, 2017 9:39:51 AM        INFO      Closed the FTP connection
Jan 6, 2017 9:39:51 AM        ERROR    Bad message
Jan 6, 2017 9:39:51 AM        INFO      Routing the control to the module 'Failed'
Jan 6, 2017 9:39:51 AM        INFO      Executing task 'sendEmail 2.0'
Jan 6, 2017 9:39:51 AM        INFO      Connecting to mail server: ####
Jan 6, 2017 9:39:51 AM        INFO      Opened the connection
Jan 6, 2017 9:39:51 AM        INFO      Message is delivered successfully
Jan 6, 2017 9:39:51 AM        INFO      Message 'Harcros FTP Rec Failed' was sent to 1 recipient(s)
Jan 6, 2017 9:39:51 AM        INFO      The message has been delivered to the following 1 addresses: 
                                        J####
                                       
Jan 6, 2017 9:39:51 AM        INFO      Closed the connection
Jan 6, 2017 9:39:51 AM        INFO      Finished task 'sendEmail 2.0'
Jan 6, 2017 9:39:51 AM        INFO      Executing task 'exitProject 1.0'
Jan 6, 2017 9:39:51 AM        INFO      Exiting project 'Harcros FTP Rec'
Jan 6, 2017 9:39:51 AM        INFO      Finished task 'exitProject 1.0'
Jan 6, 2017 9:39:51 AM        INFO      Finished project 'Harcros FTP Rec'
Jan 6, 2017 9:39:51 AM        INFO      End Date and Time: 1/6/17 9:39:51 AM

Re: Issues with SFTP Get Files command

Posted: Fri Jan 27, 2017 10:00 am
by Artis_Wright
Guten Tag,

I managed to figure out what the problem was. It turned out to be a permissions issue on the server I was connecting to. Once I got that taken care of it worked without any further issue. A note to anyone reading this. It may not say anything in the GoAnywhere logs, but make sure you triple check permissions.

-Artis