Upload using LFTP results in "mirror: Not connected"

For some reason, my deployment isn’t working anymore. The last successful deployment was on June 15 2018; yesterday I tried again, and my deployments using LFTP simply end with

mirror: Not connected

Current image used: node:alpine.

Scripts used:

- apk update
- apk add lftp
- lftp -e "debug; set ftp:ssl-allow false; set ssl:check-hostname false; open -u $USER,$PASSWORD $HOST; mirror -R -p --verbose=3 dist/ ~/client; quit"

Results in this output:

Running with gitlab-runner 11.5.0 (3afdaba6)
  on docker-auto-scale ed2dce3a
Using Docker executor with image node:alpine ...
Pulling docker image node:alpine ...
Using docker image sha256:f21b938fb1e6a92a423860898f938a0f5b53eee3b80284551862b1ef2c74414b for node:alpine ...
Running on runner-ed2dce3a-project-3375390-concurrent-0 via runner-ed2dce3a-srm-1544703538-d1e37694...
Skipping Git repository setup
Skipping Git checkout
Skipping Git submodules setup
Checking cache for default-1...
Downloading cache.zip from https://storage.googleapis.com/gitlab-com-runners-cache/project/3375390/default-1 
Successfully extracted cache
Downloading artifacts for build_staging (134077429)...
Downloading artifacts from coordinator... ok        id=134077429 responseStatus=200 OK token=_8QMM9vS
$ apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.8/community/x86_64/APKINDEX.tar.gz
v3.8.1-149-gc858bf2b3f [http://dl-cdn.alpinelinux.org/alpine/v3.8/main]
v3.8.1-149-gc858bf2b3f [http://dl-cdn.alpinelinux.org/alpine/v3.8/community]
OK: 9544 distinct packages available
$ apk add lftp
(1/5) Installing ncurses-terminfo-base (6.1_p20180818-r1)
(2/5) Installing ncurses-terminfo (6.1_p20180818-r1)
(3/5) Installing ncurses-libs (6.1_p20180818-r1)
(4/5) Installing readline (7.0.003-r0)
(5/5) Installing lftp (4.8.3-r2)
Executing busybox-1.28.4-r1.trigger
OK: 15 MiB in 20 packages
$ lftp -e "debug; set ftp:ssl-allow false; set ssl:check-hostname false; open -u $USER,$PASSWORD $HOST; mirror -R -p --verbose=3 dist/ ~/client; quit"
mirror: Not connected
ERROR: Job failed: exit code 1

What in the world am I doing wrong? Why am I not getting any useful debugging information despite having all possible debugging and verbose flags enabled?

Okay, update: There is nothing wrong with the code above.

However, for some reason while the secret variables were visible and accounted for in the GitLab interface, they have not been exported to the runner environment for some reason.

Re-adding these variables using the CI/CD settings made the script work again.

If someone else ends up here like me and the above solution does not work, make sure to take a look at the “Protect Variable” option. It was enabled by default and having that checked would only expose the variables to protected branches.
In my case, I added the pipeline config on a new branch (which was not protected) and could not access the variables.