Test FTP connection with NodeJS site

OS info

  • Operating System : Mac OSX 19.5.0
  • Wappler Version : 3.2.0

Problem description

When trying to test a SFTP connection, I have the following error :
status code=2(No such file), message=No such file
put: Access failed: No such file (public/wappler_ftp_test.htm)
---- Disconnecting

I don’t have any file in public/wappler_ftp_test.htm
It’s a new project just created. I can connect to the server via ssh and fileZilla sftp

Full logs:
Testing Connection …

  • set color:use-color yes
  • set cmd:interactive yes
  • set file:charset utf-8
  • set xfer:clobber on
  • set ftp:timezone
  • set cmd:show-status yes
  • set cmd:set-term-status yes
  • set ftp:list-options -a
  • set cmd:fail-exit yes
  • set cmd:time-style “%Y-%m-%d %H:%M:%S”
  • set ftp:passive-mode no
  • set ftp:ssl-allow no
  • set ssl:verify-certificate no
  • set sftp:auto-confirm yes
  • set sftp:connect-program “ssh -a -x -v -i ~/Downloads/ssh/mysite.com
  • set net:max-retries 3
  • set net:timeout 20
  • set net:reconnect-interval-base 5
  • set net:reconnect-interval-multiplier 1
  • open -u user,pass sftp://xxx.xxx.xxx.xxx:22
  • ls
    ---- Running connect program (ssh -a -x -v -i ~/Downloads/ssh/mysite.com -s -l user -p 22 xxx.xxx.xxx.xxx sftp)
    —> sending a packet, length=5, type=1(INIT), id=0
    <— OpenSSH_8.1p1, LibreSSL 2.7.3
    <— debug1: Reading configuration data /etc/ssh/ssh_config
    <— debug1: /etc/ssh/ssh_config line 47: Applying options for *
    <— debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 22.
    <— debug1: Connection established.
    <— debug1: identity file /Users/matthiasriverti/Downloads/ssh/mysite.com type -1
    <— debug1: identity file /Users/matthiasriverti/Downloads/ssh/mysite.com type -1
    <— debug1: Local version string SSH-2.0-OpenSSH_8.1
    <— debug1: Remote protocol version 2.0, remote software version OpenSSH_7.9p1 user-10
    <— debug1: match: OpenSSH_7.9p1 user-10 pat OpenSSH* compat 0x04000000
    <— debug1: Authenticating to xxx.xxx.xxx.xxx:22 as ‘user
    <— debug1: SSH2_MSG_KEXINIT sent
    <— debug1: SSH2_MSG_KEXINIT received
    <— debug1: kex: algorithm: curve25519-sha256
    <— debug1: kex: host key algorithm: ecdsa-sha2-nistp256
    <— debug1: kex: server->client cipher: mysite.com MAC: compression: none
    <— debug1: kex: client->server cipher: mysite.com MAC: compression: none
    <— debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
    <— debug1: Server host key: ecdsa-sha2-nistp256 SHA256:htmzRG1anunVfVut/90FeaHP++yGR+oDHS0d+tseqJ0
    <— debug1: Host ‘xxx.xxx.xxx.xxx’ is known and matches the ECDSA host key.
    <— debug1: Found key in /Users/matthiasriverti/.ssh/known_hosts:3
    <— debug1: rekey out after 134217728 blocks
    <— debug1: SSH2_MSG_NEWKEYS sent
    <— debug1: expecting SSH2_MSG_NEWKEYS
    <— debug1: SSH2_MSG_NEWKEYS received
    <— debug1: rekey in after 134217728 blocks
    <— debug1: Will attempt key: /Users/matthiasriverti/Downloads/ssh/mysite.com explicit
    <— debug1: SSH2_MSG_EXT_INFO received
    <— debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
    <— debug1: SSH2_MSG_SERVICE_ACCEPT received
    <— debug1: Authentications that can continue: publickey,password
    <— debug1: Next authentication method: publickey
    <— debug1: Trying private key: /Users/matthiasriverti/Downloads/ssh/mysite.com
    <— Load key “/Users/matthiasriverti/Downloads/ssh/mysite.com”: invalid format
    <— debug1: Next authentication method: password
    user@xxx.xxx.xxx.xxx’s password: XXXX
    <— debug1: Authentication succeeded (password).
    <— Authenticated to xxx.xxx.xxx.xxx ([xxx.xxx.xxx.xxx]:22).
    <— debug1: channel 0: new [client-session]
    <— debug1: Requesting mysite.com
    <— debug1: Entering interactive session.
    <— debug1: pledge: network
    <— debug1: client_input_global_request: rtype mysite.com want_reply 0
    <— debug1: Sending environment.
    <— debug1: Sending env LC_ALL = C
    <— debug1: Sending env LANG = C
    <— debug1: Sending subsystem: sftp
    <— got a packet, length=150, type=2(VERSION), id=0
    ---- protocol version set to 3
    —> sending a packet, length=10, type=16(REALPATH), id=1
    <— got a packet, length=45, type=104(NAME), id=1
    ---- home set to /home/user
    ---- path on wire is `/home/user
    —> sending a packet, length=21, type=11(OPENDIR), id=2
    <— got a packet, length=13, type=102(HANDLE), id=2
    ---- got file handle 00000000 (4)
    —> sending a packet, length=13, type=12(READDIR), id=3
    <— got a packet, length=653, type=104(NAME), id=3
    ---- file name count=6
    —> sending a packet, length=13, type=12(READDIR), id=4
    —> sending a packet, length=13, type=12(READDIR), id=5
    <— got a packet, length=28, type=101(STATUS), id=4
    ---- status code=1(EOF), message=End of file
    ---- eof
    <— got a packet, length=28, type=101(STATUS), id=5
    ---- status code=1(EOF), message=End of file
    drwxr-xr-x 3 user user 4096 Aug 27 09:02 .
    drwxr-xr-x 3 root root 4096 Aug 27 09:02 …
    -rw-r–r-- 1 user user 220 Apr 18 2019 .bash_logout
    -rw-r–r-- 1 user user 3526 Apr 18 2019 .bashrc
    -rw-r–r-- 1 user user 807 Apr 18 2019 .profile
    drwx------ 2 user user 4096 Aug 27 09:02 .ssh
  • put public/mysite.com -o public/mysite.com
    —> sending a packet, length=13, type=4(CLOSE), id=6
    ---- path on wire is `/home/user/public/mysite.com
    —> sending a packet, length=61, type=3(OPEN), id=7
    <— got a packet, length=24, type=101(STATUS), id=6
    ---- status code=0(OK), message=Success
    <— got a packet, length=29, type=101(STATUS), id=7
    ---- status code=2(No such file), message=No such file
    put: Access failed: No such file (public/mysite.com)
    ---- Disconnecting

Steps to reproduce

  1. Create a SFTP target with SSH Key
  2. Test Connection

To test the connection it uploads a file called wappler_ftp_test.htm to the ftp and then tries to access the file using the web address that was set in the project options. This is to test if the ftp connection is setup correctly, file upload is working and is pointing to the correct folder which should be accessible from the url set in the project options.

Is it a NodeJS project?

Yes it’s a NodeJS project

We will improve the ftp test for NodeJS as there is no point in trying to execute a NodeJS page to test as the node server is deployed later

1 Like

Thanks, how can I debug this ?
I’m pretty sure I’m entering the right information as I can connect in SFTP via FileZilla

@George Just checking if you any update on the topic and a way for me to debug this :wink:

No need for debug, you can setup your ftp as you wish, just the test won’t work but you can skip it and just save your settings.

Okay thanks